cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for well formed XML for AIM refund and capture_only

I'm trying to test out some new code I've written and I cannot seem to form the correct XML needed to issue a CREDIT or CAPTURE_ONLY via the AIM XML API. Is it possible for someone to post an example of well formed XML for a refund and/or capture_only using the AIM XML API?

-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post
stymiee
Expert
Expert
1 ACCEPTED SOLUTION

Accepted Solutions

CaptureOnly, only tested on sandbox.

<?xml version="1.0" encoding="utf-8"?>
<createTransactionRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
	<merchantAuthentication>
		<name>LoginID</name>
		<transactionKey>TranKey</transactionKey>
	</merchantAuthentication>
	<refId>myReferenceID</refId>
	<transactionRequest>
		<transactionType>captureOnlyTransaction</transactionType>
		<amount>5</amount>
		<payment>
			<creditCard>
				<cardNumber>4111111111111111</cardNumber>
				<expirationDate>1113</expirationDate>
				<cardCode>999</cardCode>
			</creditCard>
		</payment>
		<authCode>6char</authCode>
		<transactionSettings>
			<setting>
				<settingName>allowPartialAuth</settingName>
				<settingValue>false</settingValue>
			</setting>
			<setting>
				<settingName>duplicateWindow</settingName>
				<settingValue>0</settingValue>
			</setting>
			<setting>
				<settingName>emailCustomer</settingName>
				<settingValue>false</settingValue>
			</setting>
			<setting>
				<settingName>recurringBilling</settingName>
				<settingValue>false</settingValue>
			</setting>
			<setting>
				<settingName>testRequest</settingName>
				<settingValue>false</settingValue>
			</setting>
		</transactionSettings>
	</transactionRequest>
</createTransactionRequest>

 

View solution in original post

RaynorC1emen7
Expert
6 REPLIES 6

Easy solution I would think would be to use one of the SDK API's (let's say PHP), only modify the code that actually sends the XML to Authorize.net and have it print it out for you. That way you can generate the XML for any protocol you want and see what it looks like.

 

I'd go dig through the API and find the right spot to do this, but I have some work to get to.

TJPride
Expert

CaptureOnly, only tested on sandbox.

<?xml version="1.0" encoding="utf-8"?>
<createTransactionRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
	<merchantAuthentication>
		<name>LoginID</name>
		<transactionKey>TranKey</transactionKey>
	</merchantAuthentication>
	<refId>myReferenceID</refId>
	<transactionRequest>
		<transactionType>captureOnlyTransaction</transactionType>
		<amount>5</amount>
		<payment>
			<creditCard>
				<cardNumber>4111111111111111</cardNumber>
				<expirationDate>1113</expirationDate>
				<cardCode>999</cardCode>
			</creditCard>
		</payment>
		<authCode>6char</authCode>
		<transactionSettings>
			<setting>
				<settingName>allowPartialAuth</settingName>
				<settingValue>false</settingValue>
			</setting>
			<setting>
				<settingName>duplicateWindow</settingName>
				<settingValue>0</settingValue>
			</setting>
			<setting>
				<settingName>emailCustomer</settingName>
				<settingValue>false</settingValue>
			</setting>
			<setting>
				<settingName>recurringBilling</settingName>
				<settingValue>false</settingValue>
			</setting>
			<setting>
				<settingName>testRequest</settingName>
				<settingValue>false</settingValue>
			</setting>
		</transactionSettings>
	</transactionRequest>
</createTransactionRequest>

 

RaynorC1emen7
Expert

Refund

<?xml version="1.0" encoding="utf-8"?>
<createTransactionRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
	<merchantAuthentication>
		<name>loginID</name>
		<transactionKey>TranKey</transactionKey>
	</merchantAuthentication>
	<refId>myReferenceID</refId>
	<transactionRequest>
		<transactionType>refundTransaction</transactionType>
		<amount>5</amount>
		<payment>
			<creditCard>
				<cardNumber>XXXX1111</cardNumber>
				<expirationDate>1113</expirationDate>
			</creditCard>
		</payment>
		<refTransId>10digits</refTransId>
		<transactionSettings>
			<setting>
				<settingName>allowPartialAuth</settingName>
				<settingValue>false</settingValue>
			</setting>
			<setting>
				<settingName>duplicateWindow</settingName>
				<settingValue>0</settingValue>
			</setting>
			<setting>
				<settingName>emailCustomer</settingName>
				<settingValue>false</settingValue>
			</setting>
			<setting>
				<settingName>recurringBilling</settingName>
				<settingValue>false</settingValue>
			</setting>
			<setting>
				<settingName>testRequest</settingName>
				<settingValue>false</settingValue>
			</setting>
		</transactionSettings>
	</transactionRequest>
</createTransactionRequest>

 

Thank you for posting those two samples. They showed me exactly what I needed to know.

-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post

@TJPride wrote:

Easy solution I would think would be to use one of the SDK API's (let's say PHP), only modify the code that actually sends the XML to Authorize.net and have it print it out for you. That way you can generate the XML for any protocol you want and see what it looks like.

 

I'd go dig through the API and find the right spot to do this, but I have some work to get to.


It seems the SDK does not use the XML API for AIM. Since the others use it I would think they would have that one updated to use it as well. Maybe they have that in store for a future release?

-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post

Oh, hmm. I guess I got thrown off by this in the shared file:

 

if (preg_match('/xml/',$post_url)) {
            curl_setopt($curl_request, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
        }

Seemed to indicate that XML was being sent at least some of the time. And the documentation seems largely centered around XML protocols. But you're right, the AIM library seems to be constructing a POST string. So much for that idea.