MPGS
Mastercard Payment Gateway Services (MPGS) is a secure payment gateway that enables businesses to accept online payments from customers through various payment channels.
Pay the transaction.
post
https://api.plutus.ly/api/v1
/transaction/mpgs/confirm
Confirm (Pay)
Pay the transaction
Parameters
Header
Authorization*
Bearer: [Access token]
X-API-KEY*
API Key
Body
amount*
String
Transaction amount in US dollars.
Formatting is allowed with a maximum of two decimal places: XXX, XX.X, XX.XX
invoice_no*
String
Invoice number associated with transaction
return_url*
String
Redirect URL after completing the payments
customer_ip
String
[Optional] Customer IP address
lang
String
[Optional] Accepts ar or en, by default ar
Responses
200: OK
400: Bad Request
CURL
PHP
curl --location --request POST 'https://api.plutus.ly/api/v1/transaction/mpgs/confirm' \
--header 'X-API-KEY: [API_KEY]' \
--header 'Authorization: Bearer [ACCESS_TOKEN]' \
--form 'amount="[AMONUT]"' \
--form 'invoice_no="[INVOICE_NO]"' \
--form 'return_url="[RETURN_URL]"' \
--form 'customer_ip="[CUSTOMER_IP]"'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.plutus.ly/api/v1/transaction/mpgs/confirm',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'amount' => '[AMONUT]',
'invoice_no' => '[INVOICE_NO]',
'return_url' => '[RETURN_URL]',
'customer_ip' => '[CUSTOMER_IP]'
),
CURLOPT_HTTPHEADER => array(
'X-API-KEY: [API_KEY]',
'Authorization: Bearer [ACCESS_TOKEN]'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
The callback will be received from Plutu when the transaction is completed or canceled. This gives a Merchant better control of how the transaction is processed on the Merchant's side. This is useful e.g. when you want to mark an order as paid, update your shop's inventory, or add appropriate records to Merchant’s internal accounting system.
Callback response parameters:
The callback is called with HTTP GET and with the same query string parameters as in the redirect
Parameter | Description |
---|---|
gateway | Gateway name: mpgs |
approved | It will only be returned if the transaction is approved and completed |
canceled | It will only be returned if the transaction is canceled by the customer |
amount | amount sent in the request |
currency | Transaction currency refers to the currency used for processing payments through MPGS and is configured in your Plutu account. It currently supports USD |
invoice_no | Invoice number sent in the pay request |
transaction_id | Plutu transaction id |
hashed | Hash message authorization code (HMAC) is used to verify both the data integrity and the authorization of a message. |
SHA-256 HMAC is calculated as follows:
- The SHA-256 HMAC calculation includes all response query string parameters and key-value pairs except the “hashed” parameter.
- Create an SHA-256 HMAC of the resultant string using the secret key created in the Plutu account and convert it to uppercase and compare it with the “hashed” parameter received in the callback.
Last modified 2mo ago