如何使用多个付款资料(CIM)创建客户资料?

时间:2013-02-18 17:33:18

标签: xml-parsing payment-gateway authorize.net authorize.net-cim

如何使用多个付款资料(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>

1 个答案:

答案 0 :(得分: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>