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
- Drupal Commerce
- Mastercard Hosted Checkout account, with test and live Merchant IDs and passwords. If webhook payment notification is needed, the webhook shared secret is also required.
Installation & Configuration
- Install module and enable it.
- 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).
Project information
- Project categories: E-commerce
- Ecosystem: Commerce Core
12 sites report using this module
- Created by fonant on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.

