1

如何创建具有多个付款配置文件(CIM)的客户配置文件?

使用单一付款配置文件创建客户配置文件工作正常。但是,当我尝试将两个或多个付款资料添加到客户资料时,我收到以下错误。

E00003 - 命名空间“AnetApi/xml/v1/schema/AnetApiSchema.xsd”中的元素“paymentProfiles”在命名空间“AnetApi/xml/v1/schema/AnetApiSchema.xsd”中具有无效的子元素“customerType”。预期的可能元素列表:命名空间“AnetApi/xml/v1/schema/AnetApiSchema.xsd”中的“driversLicense,taxId”。

for (int 1=0;i< n;i++){
    list.add (createPaymentProfile());
}

Transaction.setPaymentProfileList(list);

上面的代码生成如下所示的 xml。

<?xml version="1.0" encoding="UTF-8"?>

<createCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
   <merchantAuthentication>
      <name>33k7hYV736488Bs8</name>
      <transactionKey>86SV776773Ac6tMV22313fE</transactionKey>
   </merchantAuthentication>
   <refId>1361101257555</refId>
   <profile>
      <merchantCustomerId>2CLINC056</merchantCustomerId>
      <description>hiiiiii.</description>
      <email />
      <paymentProfiles>
         <customerType>individual</customerType>
         <billTo>
            <firstName>Joe</firstName>
            <lastName>Test</lastName>
            <company>CompanyA</company>
            <address>hello</address>
            <city>Bangalore</city>
            <state>Delhi</state>
            <zip>560078</zip>
            <country>IN</country>
            <phoneNumber>415-555-1212</phoneNumber>
            <faxNumber>415-555-1313</faxNumber>
         </billTo>
         <payment>
            <creditCard>
               <cardNumber>370000000000002</cardNumber>
               <expirationDate>2029-12</expirationDate>
            </creditCard>
         </payment>
         <customerType>individual</customerType>
         <billTo>
            <firstName>Joe</firstName>
            <lastName>Test</lastName>
            <company>CompanyA</company>
            <address>vel</address>
            <city>Chennai</city>
            <state>AK</state>
            <zip>560089</zip>
            <country>US</country>
            <phoneNumber>415-555-1212</phoneNumber>
            <faxNumber>415-555-1313</faxNumber>
         </billTo>
         <payment>
            <creditCard>
               <cardNumber>38000000000006</cardNumber>
               <expirationDate>2029-12</expirationDate>
            </creditCard>
         </payment>
      </paymentProfiles>
   </profile>
   <validationMode>testMode</validationMode>
    </createCustomerProfileRequest>
4

1 回答 1

1

万一其他人好奇,您必须<paymentProfiles></paymentProfiles>为要创建的每个付款配置文件重复此操作。

<?xml version="1.0" encoding="UTF-8"?>

<createCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
   <merchantAuthentication>
      <name>33k7hYV736488Bs8</name>
      <transactionKey>86SV776773Ac6tMV22313fE</transactionKey>
   </merchantAuthentication>
   <refId>1361101257555</refId>
   <profile>
      <merchantCustomerId>2CLINC056</merchantCustomerId>
      <description>hiiiiii.</description>
      <email />
      <paymentProfiles>
         <customerType>individual</customerType>
         <billTo>
            <firstName>Joe</firstName>
            <lastName>Test</lastName>
            <company>CompanyA</company>
            <address>hello</address>
            <city>Bangalore</city>
            <state>Delhi</state>
            <zip>560078</zip>
            <country>IN</country>
            <phoneNumber>415-555-1212</phoneNumber>
            <faxNumber>415-555-1313</faxNumber>
         </billTo>
         <payment>
            <creditCard>
               <cardNumber>370000000000002</cardNumber>
               <expirationDate>2029-12</expirationDate>
            </creditCard>
         </payment>
        </paymentProfiles>
        <paymentProfiles>
         <customerType>individual</customerType>
         <billTo>
            <firstName>Joe</firstName>
            <lastName>Test</lastName>
            <company>CompanyA</company>
            <address>vel</address>
            <city>Chennai</city>
            <state>AK</state>
            <zip>560089</zip>
            <country>US</country>
            <phoneNumber>415-555-1212</phoneNumber>
            <faxNumber>415-555-1313</faxNumber>
         </billTo>
         <payment>
            <creditCard>
               <cardNumber>38000000000006</cardNumber>
               <expirationDate>2029-12</expirationDate>
            </creditCard>
         </payment>
      </paymentProfiles>
   </profile>
   <validationMode>testMode</validationMode>
    </createCustomerProfileRequest>
于 2015-07-23T19:23:23.270 回答