1

如何創建具有多個付款資料(CIM)的客戶資料?如何使用多個付款資料(CIM)創建客戶資料?

使用單個付款配置文件創建客戶配置文件工作正常。但是,當我嘗試將兩個或多個付款資料添加到客戶資料時,我收到以下錯誤。

E00003 - 在命名空間中的元素「paymentProfiles 'AnetApi/XML/V1 /模式/ AnetApiSchema.xsd' 在命名空間無效子元素'customerType 'AnetApi/XML/V1 /模式/ AnetApiSchema.xsd' 。預期的可能元素列表:名稱空間'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> 

回答

0

萬一別人是好奇,你必須重複<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>