New parameter needed for API version 52 and later?

Created on 18 January 2023, over 1 year ago

Looks like Mastercard changed the API between version 51 and 52, adding a new required parameter "interaction.operation".

API version 51 doesn't need "interaction.operation":

https://eu-gateway.mastercard.com/api/documentation/apiDocumentation/res...

API version 52 and later needs new "interaction.operation":

https://eu-gateway.mastercard.com/api/documentation/apiDocumentation/res...

Up to version 51, and in this module:

$params = [
    'apiOperation' => 'CREATE_CHECKOUT_SESSION',
    'apiPassword' => $password,
    'apiUsername' => "merchant.$merchant_id",
    'merchant' => $merchant_id,
    'order.id' => $order->order_number,
    'order.amount' => commerce_currency_amount_to_decimal($transaction_amount, 'GBP'),
    'order.currency' => $order_wrapper->commerce_order_total->currency_code->value(),
    'interaction.returnUrl' => url('checkout/' . $order->order_id . '/payment/return/' . $order->data['payment_redirect_key'], ['absolute' => TRUE]),
  ];

From version 52 onwards:

$params = [
    'apiOperation' => 'CREATE_CHECKOUT_SESSION',
    'apiPassword' => $password,
    'apiUsername' => "merchant.$merchant_id",
    'merchant' => $merchant_id,
    'order.id' => $order->order_number,
    'order.amount' => commerce_currency_amount_to_decimal($transaction_amount, 'GBP'),
    'order.currency' => $order_wrapper->commerce_order_total->currency_code->value(),
    'interaction.operation' => 'PURCHASE',
    'interaction.returnUrl' => url('checkout/' . $order->order_id . '/payment/return/' . $order->data['payment_redirect_key'], ['absolute' => TRUE]),
  ];

Guessing here a bit, untested.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom fonant

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.69.0 2024