Connecting Authorize.Net’s Payment Gateway to PrestaShop Using Advanced Integration Method

by ‎07-23-2012 02:15 PM - edited ‎07-23-2012 02:59 PM (31,005 Views)

Authorize.Net prides itself on our flexible APIs and the many ways in which they can be used to create your own payment system. From time to time, we like to invite guest bloggers to talk about their real-world solutions. This way, you can see working examples of the many ways that our solutions can be implemented. We hope these perspectives will help you as you determine how best to approach designing your own solutions and applications.

Today’s post is by PrestaShop, a leading open-source e-commerce solution powering more than 115,000 stores worldwide. PrestaShop uses Authorize.Net’s Advanced Integration Method (AIM) to ensure easy online selling and is the winner of the Packt Publishing 2010 and 2011 award for Best Open-source Business Application. Whether you decide to create your own solution or to use a ready-to-go offering like PrestaShop, we hope this post will provide some good information and stimulate some ideas.  

If you’re interested in blogging about your solution, please email Michelle at


Hi everyone, my name is Bryan Shaw, and I work in the communications department at PrestaShop. Today I want to briefly share with you sample code for how PrestaShop integrates with Authorize.Net.


In order for PrestaShop’s free Authorize.Net module to be successful, developers had to utilize the Advanced Integration Method (AIM).


AIM is best described as a customizable payment processing solution that gives merchants control over all steps in processing transactions online.


AIM transactions are secured through a 128-bit Secure Sockets Layer (SSL) connection between any PrestaShop store and the Authorize.Net Payment Gateway. This level of security ensures all sensitive information is transferred and stored safely, securely and in accordance with the Payment Card Industry’s (PCI) Data Security Standard.


In order to integrate the Authorize.Net Payment Gateway to the PrestaShop store, our developers had to natively rewrite the source code.


The following is a sample of the code necessary to execute Authorize.Net’s basic payment processing solutions via PrestaShop:




class authorizeNetAIM() extends PaymentModule




/* Forge the parameters */


// Authorize.Net credentials

$authorizeAIMParams['x_login'] = 'YOUR_SANDBOX_LOGIN_ID';

$authorizeAIMParams['x_tran_key'] = 'YOUR_SANDBOX_TRANSACTION_KEY';


// Card data

$authorizeAIMParams['x_card_num'] = ''; // Card Number

$authorizeAIMParams['x_card_code'] = ''; //CCV

$authorizeAIMParams['x_exp_date'] = ''; // Expiration date


// Customer infos

$authorizeAIMParams['x_address'] = '';

$authorizeAIMParams['x_zip'] = '';

$authorizeAIMParams['x_first_name'] = '';

$authorizeAIMParams['x_last_name'] = '';


// Order data

$authorizeAIMParams['x_invoice_num'] = (int)time(); // Lets generate an unique invoice number

$authorizeAIMParams['x_amount'] = 200; // $200


// Make sure we are in test mode

$authorizeAIMParams['x_test_request'] = 1;



/* Do the CURL request to */

$request = curl_init('');

curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($request, CURLOPT_POSTFIELDS, http_build_query($authorizeAIMParams));

curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);

$postResponse = curl_exec($request);



$response = explode('|', $postResponse);


// Init the objects

$authorizeaim = new authorizeAIM();

$cart = new Cart((int)$response[7]);

$customer = new Customer((int)$cart->id_customer);

$message = $response[3];

$amount = (float)$response[9];


switch ($response[0]) // Response Code


            case 1: // Payment accepted

                        $state = Configuration::get('PS_OS_PAYMENT');

                        break ;

            case 4: // Hold for review

                        $state = Configuration::get('PS_OS_ERROR'); // Can put any custom Order State here

                        break ;

            default: // Error

                        $state = Configuration::get('PS_OS_ERROR');



$authorizeaim->validateOrder((int)$cart->id, $state, $amount,

            'Payment with', $message, NULL, NULL, false, $customer->secure_key);


Note: This is a non-working code provided to offer a conceptualized example of how to execute basic payment processing solutions using Authorize.Net’s AIM module in your PrestaShop store.


The source code provided above also employs basic security features such as Card Code Verification (CCV), Address Verification, as well as ‘hold for review’ options.


The CCV filter simply allows merchants to compare the card code submitted with the card code on file with the bank. If necessary, the merchant can choose to hold a payment for review for security reasons.


The Address Verification Service (AVS) Filter allows merchants to verify a customer’s billing address with the billing address on file with the bank.  Again, this filter grants merchants the option to hold payment processing should security concerns arise.


The most recent version of the free Authorize.Net module is available with PrestaShop’s newest v1.4.8 software, now available for download.

You can learn more about PrestaShop by visiting their website. There, you can also download and install the free Authorize.Net module to your store. 


by awahab
on ‎09-08-2014 03:08 AM



Currently i am using module in prestashop 1.6 but i am facing one problem, how to charged unsettled transaction to using preasthop module and also transcation id will not return or save in the our database. Can you have any solution regarding this issue.




by archdude4458
on ‎03-02-2015 06:17 AM


Authorize Net takes two transaction for prestashop payment while implementing Tax Rule.


Let take a simple order that valued $100 amount and $10 for Tax rule extra charge.
When customer going for payment via Authorize net module then system will take separate transaction for single order.
That means $100 for one transaction and $10 for second transaction.
Also in backend, order detail page shows "not paid" status in red bold fonts.

Thanking you,

by Chouhan4it
on ‎08-13-2015 03:17 AM

Before installing this module , please enable your SSL.


1)Hosting there should be a SSL certificate installed.

2)Presta BO: Preferences > General -> Enable SSL.


by ilclaudio
on ‎07-29-2016 05:41 AM


does exist the documentation on how to use the module AIM on Prestashop 1.6?