[Drupal] How to set up Authorize.Net ARB to work with Drupal commerce

| | 2 min read

Authorize.net is a popular alternative to Paypal for eCommerce websites especially its recurring transaction product - Authorize.net ARB (Automated Recurring Billing). Drupal support for Authnet ARB is available through Ubercart but it is not available for Drupal_commerce. However there is a workaround to setup Authorizet.net ARB to work with Drupal commerce. Read on to know more.

There is no Authorize.net ARB module for Drupal commerce but there is a sandbox module - Authnet ARB This module does not work straight out of box but you need to make a few changes. But before that lets get familiar with the module

Drupal authnet_arb sandbox module uses authorize.net SDK for ARB API request, so we have to install the sdk for using this module. First of all we can look on what else features the authnet_arb module provide and then we can look on how to integrate it with drupal commerce.

Features provided by authnet_arb module.

  1. Payment method for ARB:
    The sandbox module provides an additional payment method named 'Recurring payments with Authorize.Net ARB (with credit card)' along with default drupal commerce payement methods. Enabling this payment method, we get an option for choosing 'Recurring payments' method of payment in drupal commerce payment form.
     * Implements hook_commerce_payment_method_info().
    function authnet_arb_commerce_payment_method_info() {
     $payment_methods = array();
     $payment_methods['authnet_arb'] = array(
      'base' =>  'authnet_arb',
      'title' => t('Recurring payments with Authorize.Net ARB (with credit card)'),
      'short_title' => t('Authorize.Net ARB CC'),
      'display_title' => t('Recurring payments'),
      'description' => t('Integrates Authorize.Net ARB for transactions.'),
      'callbacks' => array(
        'settings_form' => 'authnet_arb_commerce_settings_pane',
        'submit_form' => 'authet_arb_payment_pane',
        'submit_form_submit' => 'authet_arb_payment_pane_submit',
        'submit_form_validate' => 'authet_arb_payment_pane_validate',
       'file' => 'commerce.inc',
     return $payment_methods;
  2. Silent post URL:

    Silent post is the feature provided by Authorize.Net, which will post a http request to our domain silent url (which we need to configure in Authorize.Net account settings page) with the transaction details of ARB subscriptions payement as xml. Using this we can listen to the post request coming to our drupal site and do necessary business logic according to transaction status details.

     * Implements hook_menu().
    function authnet_arb_menu () {
      $items = array();
      $items['authnet-arb-silentpost'] = array(
        'type' => MENU_CALLBACK,
        'page callback' => 'authnet_arb_silentpost',
        'access callback' => TRUE,
      return $items;
  3. Authnet ARB settings:
    Admin config page for setting the API login Id and transaction key. This form also provide an option for sandbox transactions, which will be more useful while testing.
  4. ARB Subscription cancellation form:
    Using this subscribers can cancel their ARB subscription any time they want.

Since we are now familiar with the module, lets get to work on those changes to make this module production ready. Stay tuned for our second part.