I am trying to use new migs getaway (MPGS) I followed the code in the next url
https://ap-gateway.mastercard.com/api/documentation/integrationGuidelines/hostedCheckout/integrationModelHostedCheckout.html
Sure I am replaced all required fields
<html>
<head>
<script src="https://ap-gateway.mastercard.com/checkout/version/36/checkout.js"
data-error="errorCallback"
data-cancel="cancelCallback">
</script>
<script type="text/javascript">
function errorCallback(error) {
console.log(JSON.stringify(error));
}
function cancelCallback() {
console.log('Payment cancelled');
}
Checkout.configure({
merchant: 'xxxxxx',
order: {
amount: function() {
//Dynamic calculation of amount
return 80 + 20;
},
currency: 'USD',
description: 'Ordered goods',
id: 'xxxxxx'
},
interaction: {
merchant: {
name: 'xxxxxx',
address: {
line1: '200 Sample St',
line2: '1234 Example Town'
}
}
}
});
</script>
</head>
<body>
...
<input type="button" value="Pay with Lightbox" onclick="Checkout.showLightbox();" />
<input type="button" value="Pay with Payment Page" onclick="Checkout.showPaymentPage();" />
...
</body>
but all the time I got this error as json object
{
"cause":"INVALID_REQUEST",
"explanation":"Invalid request",
"supportCode":"6RVIIBKFVR6CG",
"result":"ERROR"
}
1. Do create checkout session request using a server to server request using the below curl request or API request
URL https://cibpaynow.gateway.mastercard.com/api/rest/version/60/merchant/{merchantId}/session HTTP Method POST Authentication This operation requires authentication via one of the following methods: Certificate authentication. Basic HTTP authentication as described at w3.org. Provide 'merchant.' in the userid portion and your API password in the password portion.
{
"apiOperation": "CREATE_CHECKOUT_SESSION",
"interaction": {
"operation": "PURCHASE"
},
"order": {
"id": "anyorder",
"currency": "EGP",
"description": "Order Goods",
"amount": "10.00"
}
}
2. Get session ID from response and place it in the attached sample HTML page I have created:
<html>
<head>
<script src="https://cibpaynow.gateway.mastercard.com/checkout/version/57/checkout.js" data-error="errorCallback" data-cancel="cancelCallback"></script>
<script type="text/javascript">
function errorCallback(error) {
console.log(JSON.stringify(error));
}
function cancelCallback() {
console.log('Payment cancelled');
}
Checkout.configure({
session: {
id: '' //session ID generated from the request
},
interaction: {
merchant: {
name: '', //your MID
address: {
line1: '200 Sample St',
line2: '1234 Example Town'
}
}
}
});
</script>
</head>
<body>
...
<input type="button" value="Pay with Lightbox" onclick="Checkout.showLightbox();" />
<input type="button" value="Pay with Payment Page" onclick="Checkout.showPaymentPage();" />
...
</body>
</html>
3. Save the page and open the page in browser then press on the button "Pay with lightbox"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With