This module provides a Drupal Commerce payment method using the Mastercard Hosted Checkout payment service.

The payment method redirects to the Mastercard-hosted payment page. Once the customer has entered their card details successfully, they are redirected back to the Drupal Commerce site where the order is marked as being Checkout Completed.

Some time later, Mastercard's webhook system POSTs payment notification data to the shop site, and the module checks the validity before adding a Payment to the order.

A hook is defined that allows other custom modules to alter the data from the order that is to be sent to Mastercard, for example to add in the customer's billing address details.

Requirements

Installation & Configuration

  1. Install module and enable it.
  2. Configure the payment method with your Mastercard API details at admin/commerce/config/payment-methods.

Usage

The payment method can run in test or live mode, with credentials configured for both.

Once configured, the payment method works like any other Commerce payment method.

Optionally, create a custom module to implement hook_commerce_mastercard_post_data_alter(&$data, $order), to allow the data being sent to Mastercard to be modified with other order information, such as the customer's billing address.

If the payment method has debug mode enabled, the data sent to and received from Mastercard is logged in the Watchdog log.

Credits

Development of this module was sponsored by Cycling UK (formerly known as CTC, the UK's national cycling charity).

Supporting organizations: 
Initial development and supporting D8/D9 version

Project information

Releases