Apr
05

Sample code for CIM Refund for integeration and Testing

————————————————————————————————————-
The following is the XML sent to  create a profile Refund transaction successfully.
————————————————————————————————————-
<?xml version=”1.0″ encoding=”utf-8″?>
<createCustomerProfileTransactionRequest xmlns=”AnetApi/xml/v1/schema/AnetApiSchema.xsd”>
<merchantAuthentication>
<name>YourUserLogin</name>
<transactionKey>YourTranKey</transactionKey>
</merchantAuthentication>
<transaction>
<profileTransRefund>
<amount>10.95</amount>
<tax>
<amount>1.00</amount>
<name>WA state sales tax</name>
<description>Washington state sales tax</description>
</tax>
<shipping>
<amount>2.00</amount>
<name>ground based shipping</name>
<description>Ground based 5 to 10 day shipping</description>
</shipping>
<lineItems>
<itemId>ITEM00001</itemId>
<name>name of item sold</name>
<description>Description of item sold</description>
<quantity>1</quantity>
<unitPrice>6.95</unitPrice>
<taxable>true</taxable>
</lineItems>
<lineItems>
<itemId>ITEM00002</itemId>
<name>name of other item sold</name>
<description>Description of other item sold</description>
<quantity>1</quantity>
<unitPrice>1.00</unitPrice>
<taxable>true</taxable>
</lineItems>
<customerProfileId>10000</customerProfileId>
<customerPaymentProfileId>20000</customerPaymentProfileId>
<customerShippingAddressId>30000</customerShippingAddressId>
<creditCardNumberMasked>XXXX1111</creditCardNumberMasked>
<order>
<invoiceNumber>INV000001</invoiceNumber>
<description>description of transaction</description>
<purchaseOrderNumber>PONUM000001</purchaseOrderNumber>
</order>
<transId>40000</transId>
</profileTransRefund>
</transaction>
<extraOptions><![CDATA[]]></extraOptions>
</createCustomerProfileTransactionRequest>

So in C#(asp.net) CreateTransaction function you need to change  according to above xml request format Refund
for example
createCustomerProfileTransactionRequest request = new createCustomerProfileTransactionRequest();
XmlAPIUtilities.PopulateMerchantAuthentication((ANetApiRequest)request);
profileTransactionType new_trans = new profileTransactionType();

profileTransRefundType new_item = new profileTransRefundType();

Note:

For Refund Transactions
• If you are submitting a refund against a previous CIM transaction, the following guidelines apply: include customerProfileId, customerPaymentProfileId, and transId.
• customerShippingAddressId is optional.
• creditCardNumberMasked, bankRoutingNumberMasked, and bankAccountNumberMasked do not need to be included, but will be validated if they are included.

For more reference please verify this pdf http://www.authorize.net/support/CIM_XML_guide.pdf

Apr
01

CIM Authentication Error

The reason for experiencing user authentication errors is, running the script against the developer test url:
https://apitest.authorize.net/xml/v1/request.api
while using  real authorize.net login id and transaction key.

By “real”, we mean the credentials you’d actually use in a live, business environment. Those credentials will only work with the production url:
https://api.authorize.net/xml/v1/request.api

The developer test url is only for those who registered for a free authorize.net developer test account. Your real, live authorize.net account login id and transaction key won’t work with the ‘apitest.authorize.net’ url.

Two ways:

1) Register for a authorize.net developer account to get a login id and transaction key to use against the “test” url. Click the “Request a test account” link near the bottom of this page:
http://developer.authorize.net/

2) Just use the existing developer login id and transaction key that’s already included with the script. Yes, they are real and do work.

Mar
17

CIM Authentication Error Display CIM Info using PHP SDK

1)      we  need to pass customer(user) profile id  for getting payment information of the customer that contains (masked credit card number)

sample getCustomerProfile  XML request

<?xml version=”1.0″ encoding=”utf-8″?>
<getCustomerProfileRequest xmlns=”AnetApi/xml/v1/schema/AnetApiSchema.xsd”>
<merchantAuthentication>
<name>YourUserLogin</name>
<transactionKey>YourTranKey</transactionKey>
</merchantAuthentication>
<customerProfileId>ProfileID</customerProfileId>
</getCustomerProfileRequest>

2)In get CustomerProfile profile response,we need to parse masked credit card number

sample getCustomerProfile  xml response

<?xml version=”1.0″ encoding=”utf-8″?>
<getCustomerProfileResponse xmlns=”AnetApi/xml/v1/schema/AnetApiSchema.xsd”>
<messages>
<resultCode>Ok</resultCode>
<message>
<code>I00001</code>
<text>Successful.</text>
</message>
</messages>
<profile>
<merchantCustomerId>custId123</merchantCustomerId>
<description>some description</description>
<email>mark@example.com</email>
<customerProfileId>10000</customerProfileId>
<paymentProfiles>
<billTo>
<firstName>John</firstName>
<lastName>Doe</lastName>
<company></company>
<address>123 Main St.</address>
<city>Bellevue</city>
<state>WA</state>
<zip>98004</zip>
<country>USA</country>
<phoneNumber>000-000-0000</phoneNumber>
<faxNumber></faxNumber>
</billTo>
<customerPaymentProfileId>20000</customerPaymentProfileId>
<payment>
<creditCard>
<cardNumber>XXXX1111</cardNumber>
<expirationDate>XXXX</expirationDate>
</creditCard>
</payment>
</paymentProfiles>
<paymentProfiles>
<customerPaymentProfileId>20001</customerPaymentProfileId>
<payment>
<bankAccount>
<accountType>checking</accountType>
<routingNumber>XXXX0000</routingNumber>
<accountNumber>XXXX0000</accountNumber>
<nameOnAccount>John Doe</nameOnAccount>
<bankName>Bank of Washington</bankName>
</bankAccount>
</payment>
</paymentProfiles>
<shipToList>
<firstName>John</firstName>
<lastName>Doe</lastName>
<company></company>
<address>123 Main St.</address>
<city>Bellevue</city>
<state>WA</state>
<zip>98004</zip>
<country>USA</country>
<phoneNumber>000-000-0000</phoneNumber>
<faxNumber></faxNumber>
</shipToList>
<shipToList>
<firstName>Jane</firstName>
<lastName>Doe</lastName>
<address>123 Main St.</address>
<city>Bellevue</city>
<state>WA</state>
<zip>98004</zip>
<country>USA</country>
<phoneNumber>000-000-0000</phoneNumber>
</shipToList>
</profile>
</getCustomerProfileResponse>

for example in php

$PayRes = CustomerProfile_xml_response

foreach($PayRes->profile->paymentProfiles AS $key => $paymentid)

{

$paymentid->payment->creditCard->cardNumber

//(gives the Masked Credit card information )

}

 

» Newer posts