How to write a payment module to Pay payment API

The payment API Pay module provides a common API for forms and payment modules to be connected. This page describes the process of writing a payment module to fit the Pay API and enable it to be used as one among many payment options available.

This instruction set is created while implementing the Tripletex payment method and code examples are picked from there.

To implement the interface to Pay, the payment method module must implement the hook hook_pay_method_handler_info() and may look something like this:

/**
 * This hook is used to inform Pay of available payment method handlers.
 * Administrators will be able to create new instances of payment methods,
 * based on the capabilities and options for your handler(s).
 */
function tripletex_pay_method_handler_info() {
  return array(
    'pay_method_custom' => array(
      'title' => t('Electronic invoice'),
      'description' => t('Create an electroinc invoice and have that shipped to the customers e-mail address'),
      'parent' => 'pay_method_custom',
      'module' => 'tripletex',
      'path' => drupal_get_path('module', 'tripletex') .'/includes',
    ),
  );
}

Subscribe with RSS Subscribe to RSS - Pay