As you may already know, Authorize.net is very useful and popular payment method with Magento. That is why we decided to write an article on this topic, where we share our own knowledges and experience on how to deal with this system.
Authorize.net is a Payment Gateway service which acts as a middleware between merchant’s account bank and customer credit card issuer bank. In this case, check please the following scheme to see its working way:
Generally speaking, a payment process with Authorize.net consists of such steps as:
1. The customer submits his credit card for payment.
2. Transaction is passed to the Authorize.net processor.
3. Processor submits the transaction to the credit card network, and the transaction is routed to the bank that issued the credit card.
4. The issuing bank approves or declines the transaction based on the customer’s available funds and passes the transaction results back to the credit card network. Then, the transaction results relayed to the merchant bank’s processor.
5. When the transaction results are saved, then Authorize.net replies to the website.
6. The last step is when the merchant delivers goods or services to the buyer.
Now we know how this payment method works. However, if we will face with some Authorize.net issues we should also know the right way on how to debug it. The second part of this article will describe useful tips for this challenge. In this case, at first, let’s create a sandbox account.
Just fill “API Login ID” and “Transaction Key” with provided data.
Then, go to System > Configuration > Payment methods > Authorize.net.
Note that ‘Simon’ is a default secret question answer for sandbox transaction key reset.
The next step is to change Gateway URL to https://test.authorize.net/gateway/transact.dll:
Furthermore, for the production purposes the value of CGI_URL_TD constant in app/code/core/Mage/Paygate/Model/Authorizenet.php should be changed from ‘https://apitest.authorize.net/xml/v1/request.api‘ to ‘https://api.authorize.net/xml/v1/request.api‘.
As a result, the debug option will dump transaction data to the log file.
Also, there will be a need to create a test order. By default, Authorize.net simply passes all orders. In this case, you need to set filters in Fraud Detection Suite.
We can admit that the most significant filters are:
– CCV/CCV2 – Card Code Verification.
– AVS – Address Verification Service.
– Daily Velocity Filter.
In addition, for $9.99 Authorize.net offers AFDS – Advanced Fraud Detection Suite.
Continuing our theme, after submitting an order if the action for triggered filter is Authorize and Review – it will be held for review.
They must then be either approved or voided within 30 days of the submit date. If no action is being taken in the 30-day period, the transactions will expire.
And the orders in the review/suspected fraud status have Get Payment Update button.
It is useful that by pressing Get Payment Update in Magento you can receive an order status.
Also, it is necessary to turn on Transaction Details API in Auth.net sandbox account. Then, if you approve order – its status will be changed.
In var/log/payment_authorizenet.log will appear the following data:
2013-12-26T12:22:42+00:00 DEBUG (7): Array ( [request] => Array ( [x_version] => 3.1 [x_delim_data] => True [x_relay_response] => False [x_test_request] => FALSE [x_login] => **** [x_tran_key] => **** [x_type] => AUTH_ONLY [x_method] => CC [x_invoice_num] => 100000005 [x_amount] => 94.99 [x_currency_code] => USD [x_allow_partial_auth] => False [x_first_name] => ersdtuyio [x_last_name] => weasrdtyu [x_company] => [x_address] => resdtfuy [x_city] => esrtdyf [x_state] => Alaska [x_zip] => 45678 [x_country] => US [x_phone] => 3456789 [x_fax] => [x_cust_id] => [x_customer_ip] => 127.0.0.1 [x_customer_tax_id] => [x_email] => firstname.lastname@example.org [x_email_customer] => 0 [x_merchant_email] => [x_ship_to_first_name] => ersdtuyio [x_ship_to_last_name] => weasrdtyu [x_ship_to_company] => [x_ship_to_address] => resdtfuy [x_ship_to_city] => esrtdyf [x_ship_to_state] => Alaska [x_ship_to_zip] => 45678 [x_ship_to_country] => US [x_po_num] => [x_tax] => 0 [x_freight] => 5 [x_card_num] => **** [x_exp_date] => **** [x_card_code] => **** ) [result] => Array ( [response_code] => 4 [response_subcode] => 1 [response_reason_code] => 253 [response_reason_text] => Your order has been received. Thank you for your business! [approval_code] => 2HJXUQ [avs_result_code] => Y [transaction_id] => 2203923253 [invoice_number] => 100000005 [description] => [amount] => 94.99 [method] => CC [transaction_type] => [customer_id] => [md5_hash] => 5AE4A08E0A05BDE5311DDE0A2493BA10 [card_code_response_code] => [c_av_vresponse_code] => 2 [split_tender_id] => [acc_number] => XXXX1111 [card_type] => Visa [requested_amount] => [balance_on_card] => ) [__pid] => 709 )
and for payment update:
2013-12-26T12:30:35+00:00 DEBUG (7): Array ( [request] => <? xml version =”1.0″ encoding =”utf - 8″?> <getTransactionDetailsRequest xmlns=”AnetApi/xml/v1/schema/AnetApiSchema.xsd”> <merchantAuthentication> <name>82jWWnxj3eJ5</name> <transactionKey>69ZHq6C22mk9Mjsc</transactionKey> </merchantAuthentication> <transId>2203923253</transId> </getTransactionDetailsRequest> [result] => <U+FEFF><? xml version = ”1.0″ encoding = ”utf-8″ ?> <getTransactionDetailsResponse 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>Ok</resultCode> <message><code>I00001</code> <text>Successful.</text> </message> </messages> <transaction> <transId>2203923253</transId> <submitTimeUTC>2013-12-26T12:22:42.23Z</submitTimeUTC> <submitTimeLocal>2013-12-26T04:22:42.23</submitTimeLocal> <transactionType>authOnlyTransaction</transactionType> <transactionStatus>authorizedPendingCapture</transactionStatus> <responseCode>1</responseCode> <responseReasonCode>1</responseReasonCode> <responseReasonDescription>Approval</responseReasonDescription> <authCode>2HJXUQ</authCode> <AVSResponse>Y</AVSResponse> <FDSFilterAction>authAndHold</FDSFilterAction> <FDSFilters> <FDSFilter> <name>Enhanced AVS Handling Filter</name> <action>authAndHold</action> </FDSFilter> <FDSFilter> <name>Hourly Velocity Filter</name> <action>authAndHold</action> </FDSFilter> <FDSFilter> <name>Transaction IP Velocity Filter</name> <action>authAndHold</action> </FDSFilter> </FDSFilters> <order> <invoiceNumber>100000005</invoiceNumber> </order> <authAmount>94.99</authAmount> <settleAmount>94.99</settleAmount> <shipping> <amount>5.00</amount> </shipping> <taxExempt>false</taxExempt> <payment> <creditCard> <cardNumber>XXXX1111</cardNumber> <expirationDate>XXXX</expirationDate> <cardType>Visa</cardType> </creditCard> </payment> <customer> <email>email@example.com</email> </customer> <billTo> <firstName>ersdtuyio</firstName> <lastName>weasrdtyu</lastName> <address>resdtfuy</address> <city>esrtdyf</city> <state>Alaska</state> <zip>45678</zip> <country>US</country> <phoneNumber>3456789</phoneNumber> </billTo> <shipTo> <firstName>ersdtuyio</firstName> <lastName>weasrdtyu</lastName> <address>resdtfuy</address> <city>esrtdyf</city> <state>Alaska</state> <zip>45678</zip> <country>US</country> </shipTo> <recurringBilling>false</recurringBilling> <customerIP>127.0.0.1</customerIP> </transaction> </getTransactionDetailsResponse> [__pid] => 753 )
You are welcome to leave your feedback if anyone has any different experience or solution of this topic.