I am trying to integrate ARB using classic ASP. There is no sample code available from Authorize.net for this. I followed the PHP code and the reference guide to set up the XML file, but I am confused how to post this to authorize.net in order to get a response back.
in AIM for a single transaction, there were several methods of posting. I successfully used this method:
Dim objHttp
Set objHTTP = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
objHTTP.Open "GET", "https://secure.authorize.net/gateway/transact.dll?" & vPostData, false
objHTTP.Send()
strRetval = objHTTP.ResponseText
Do I use something similar for ARB? If so, how do I correctly send the XML file using this? There were other options in the AIM guide, such as XMLHTTP - should I use that?
I would assume that someone has done this before, and I just need a few lines of code to finish up this aspect of the project. Thank you.
01-04-2011 09:32 AM
Have you read the ARB PDF guide? All you pretty much have to do is POST the XML payload to one of the API urls and parse the results.
I would check a ASP programming forum or Stackoverflow on how to post XML data with ASP.
01-04-2011 11:25 AM
I have read the ARB guide, but it provides no information on how to post the XML file.
I used the AIM code that posted a message using XMLHTTP, and modified it slightly to post the ARB XML file:
Dim xml
Dim strStatus
Dim strRetval
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.open "get", "https://api.authorize.net/xml/v1/request.api", false
xml.send vPostData
strStatus = xml.Status
strRetval = xml.responseText
Set xml = nothing
It doesn't work.
Error code :E00002 (The content-type specified is not supported)
Do you know what I need to do to correct this error? The XML that I am submitting seems to be well-formed, as you can see below:
<?xml version="1.0" encoding="utf-8"?>
<ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>xxxxx</name>
<transactionKey>xxxxx</transactionKey>
</merchantAuthentication>
<refId>12</refId>
<subscription>
<name>Larry Seltzer</name>
<paymentSchedule>
<interval>
<length>12</length>
<unit>months</unit>
</interval>
<startDate>2011-1-4</startDate>
<totalOccurrences>12</totalOccurrences>
<trialOccurrences>0</trialOccurrences>
</paymentSchedule>
<amount>10</amount>
<trialAmount>0</trialAmount>
<payment>
<creditCard>
<cardNumber>4111111111111111</cardNumber>
<expirationDate>2011-01</expirationDate>
</creditCard>
</payment>
<billTo>
<firstName>Larry</firstName>
<lastName>Seltzer</lastName>
</billTo>
</subscription>
</ARBCreateSubscriptionRequest>
01-04-2011 12:11 PM
If I can't get a solution for this here, where else can I turn for a solution? Are there places where I can hire an expert for a few dollars to offer a solution?
01-04-2011 09:43 PM
Have you look at the sample code at
http://developer.authorize.net/resources/files/samplecode/asp_cim.zip
It not for ARB but it use classic ASP with XML.
01-05-2011 05:18 AM - edited 01-05-2011 05:20 AM
I've been using this classic asp ARB snippet for years... just replace the info with your own.... hope it helps:
01-05-2011 08:33 AM
sefi thanks for this - but the code is for AIM, not for ARB (Irecurring billing). for example - your code doesnt ask how long the subscription is , how oten to charge the card etc...
do you have sample for ARB ?
thanks!
10-15-2013 02:41 AM