Reply
Highlighted
Member
Posts: 1
Registered: ‎11-23-2013

Send multiple Subscriptions in one API call

I am building a shopping cart that allows users to purchase multple subscriptions at the same time.  I have the code working to successfully work with one subscription.  But when I try to pass a second <subscription> tag in the XML, it gives me the following error:

 

The element 'ARBCreateSubscriptionRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'subscription' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'

 

Here is a sample of the XML I am trying to pass:

 

<?xml version="1.0" encoding="utf-8"?> <ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <merchantAuthentication> <name>89g8aRKVR</name> <transactionKey>5Kd9gH3A86z85Mpk</transactionKey> </merchantAuthentication> <refId>866FC385-546B-11</refId> <subscription> <name>Test Product 1</name> <paymentSchedule> <interval> <length>6</length> <unit>months</unit> </interval> <startDate>2013-11-23</startDate> <totalOccurrences>9999</totalOccurrences> </paymentSchedule> <amount>250</amount> <payment> <creditCard> <cardNumber>4111111111111111</cardNumber> <expirationDate>2015-01</expirationDate> <cardCode>123</cardCode> </creditCard> </payment> <order> <invoiceNumber>86716676-546B-11</invoiceNumber> </order> <customer> <id>117</id> <email>test@yahoo.com</email> </customer> <billTo> <firstName>test</firstName> <lastName>test</lastName> <address>test</address> <city>test</city> <state>CA</state> <zip>54321</zip> </billTo> </subscription> <subscription> <name>Test Product 2</name> <paymentSchedule> <interval> <length>6</length> <unit>months</unit> </interval> <startDate>2013-11-23</startDate> <totalOccurrences>9999</totalOccurrences> </paymentSchedule> <amount>250</amount> <payment> <creditCard> <cardNumber>4111111111111111</cardNumber> <expirationDate>2015-01</expirationDate> <cardCode>123</cardCode> </creditCard> </payment> <order> <invoiceNumber>86716676-546B-11</invoiceNumber> </order> <customer> <id>117</id> <email>test@yahoo.com</email> </customer> <billTo> <firstName>test</firstName> <lastName>test</lastName> <address>test</address> <city>test</city> <state>CA</state> <zip>54321</zip> </billTo> </subscription> </ARBCreateSubscriptionRequest>

 

Does anyone know the correct XML syntax for passing multiple different Subscriptions in the same call?  I have searched all around through the documentation and internet and cannot find a example similar to this.

 

Thanks all for the help.

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Send multiple Subscriptions in one API call

There isn't one. One ARB per call

Documentation is here

http://developer.authorize.net/api/arb/

and XML Schema

https://api.authorize.net/xml/v1/schema/AnetApiSchema.xsd