cancel
Showing results for 
Search instead for 
Did you mean: 

Problems getting ARB transaction subscriptions to save

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>
 
bbdesign
Contributor
20 REPLIES 20

"https://api.authorize.net/xml/v1/request.api" should have return error if the input is blank.

Have you try just response.write out the inet.content? When the screen load, did it get any script error?

RaynorC1emen7
Expert

I'm getting absolutely no response back. There was no script error on the page, it executed just the way I would expect, but no ARB happens. I'm doing 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","POST")
returncontent=inet.content

parser.async=false
parser.loadxml(returncontent)

 

...then response.write(returncontent) and there is nothing. I am also doing a response.write(xml) to make sure it is populated, and it is. I have tried both GET and POST, no affect.

 

I am using this same component on another website (same server) to pull in currency exchange rates, here is the (very similar) code:

 

set inet=server.CreateObject("khttp.inet")
set parser=server.CreateObject("Msxml2.DOMDocument.4.0")

inet.xml=xml
call inet.openurl("http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml","GET")

parser.async=false
parser.loadxml(inet.content)

 

That script runs once a day, and is successful. So I don't see why my ARB wouldn't be working?

 

Thank you for your help!

Since it is https, maybe something is not setup correct for khttp.inet?

But I am already doing auth_capture transactions using the same component:

 

call inet.openurl("https://secure.authorize.net/gateway/transact.dll","POST")

 

Those work fine.

Can you even tell if it get to "https://api.authorize.net/xml/v1/request.api"? is there other data from the response other than inet.content? Can't think of anything else since I don't have the same setup.

The documentation for khttp is available here:

 

http://www.rainfall.com/coding/khttp.htm

 

There are some other return variables, I ran another test and got:

 

.content=
.contentlength=0
.headers=

 

I don't understand why I'm getting nothing. If I put the URL in my browser, I of course get an error message.

 

There is a setting called "ignore_ssl_errors", I would ASSUME authorize.net doesn't have that kind of a problem?

 

Note there is a setting in that documentation called XML Example, the default is to use regular POST variables. But as I said, I have used this component many times for other XML transfers and it works fine.

 

This is rather frustrating.

response.write the .header

and also set the ignore_ssl_errors, others had issue with ssl before.

Wow, that did it! They really ought to keep their certificates valid. Anyway, here is the response. I don't know what those junk characters are in the beginning. So not sure why the error, I don't see E00002 on the list of error codes. What "content-type" is the API expecting?

 

<?xml version="1.0" encoding="utf-8"?><ErrorResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Error</resultCode><message><code>E00002</code><text>The content-type specified is not supported.</text></message></messages></ErrorResponse>

The content-type need to be "text/xml", maybe is the addHTTPHeaders?