I am trying to send XML data to the ARB API to setup subscriptions, using an application I wrote in Classic ASP. I am actually doing two separate transactions. The first is a regular auth_capture to charge the credit card an initial amount of $20.00. I wait until that transaction goes through, receive success message from the API, clear out my objects, then create a new transaction for the ARB subscription. The auth_capture works fine, ARB does not. For the auth_capture I am sending x_login, x_Password and x_Tran_Key data. For the ARB I am sending name (same as x_login) and transactionKey (same as x_Tran_Key). I do not get a message back, no error message, no returned XML... the screen loads but the subscription does not appear when I check by logging into the Authorize.Net merchant website. My XML code is attached, I only removed the name, transactionKey and cardNumber data.
I am using a component called khttp.inet which I have used for sending/receiving XML in other applications. My ASP code looks like this:
set inet=server.CreateObject("khttp.inet")
set parser=server.CreateObject("Msxml2.DOMDocument.4.0")
inet.xml=xml
call inet.openurl("https://api.authorize.net/xml/v1/request.api","GET")
returncontent=inet.content
parser.async=false
parser.loadxml(inet.content)
on error resume next
inet.close
set inet=nothing
parser.close
set parser=nothing
on error goto 0
I assume https://api.authorize.net/xml/v1/request.api is correct. The component asks for a GET or a POST. I have been using GET, not sure if that matters to the API or not.
I have been using AIM for many years, this is the first time a client has asked me to setup ARB. I wish I had an error message or something, but i'm not getting anything. When I write the variable returncontent, it is blank. Unless there is a problem loading XML data as text. Where I have parser.loadxml(inet.content), in another application unrelated to this project, that brings in the XML fine. I'm not sure how to properly read that, though.
I would appreciate any assistance. Thank you!
<?xml version="1.0" encoding="utf-8"?> <ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <merchantAuthentication> <name></name> <transactionKey></transactionKey> </merchantAuthentication> <refId>Campaign 2012</refId> <subscription> <name>Campaign 2012</name> <paymentSchedule> <interval> <length>1</length> <unit>months</unit> </interval> <startDate>2011-11-30</startDate> <totalOccurrences>12</totalOccurrences> </paymentSchedule> <amount>12.00</amount> <payment> <creditCard> <cardNumber></cardNumber> <expirationDate>2014-04</expirationDate> </creditCard> </payment> <order> <invoiceNumber>12422</invoiceNumber> </order> <customer> <id>10000</id> <email>brad@bbdesign.com</email> <phoneNumber>610-693-6080</phoneNumber> <faxNumber></faxNumber> </customer> <billTo> <firstName>Brad</firstName> <lastName>Bansner</lastName> <company>BB Design</company> <address>245 Lamms Mill Road</address> <city>Wernersville</city> <state>PA</state> <zip>19565</zip> <country>UNITED STATES</country> </billTo> </subscription> </ARBCreateSubscriptionRequest>
11-29-2011 10:45 AM
I believe that works. Thank you again!
12-01-2011 03:49 PM