6

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"
}
Saeed Zhiany
  • 2,051
  • 9
  • 30
  • 41
osama saeed
  • 81
  • 1
  • 3

4 Answers4

1

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"

0

Recheck your fetched SESSIONID and merchantId , These error from the gateway implies that you have not provided correct credentials for gateway to execute Payment .

Farhan
  • 61
  • 8
0

You need a valid merchantID to request the hosted checkout pop or checkout page.

0

Make sure that following details are correct and same details are used for both checkout session creation and checkout configuring.

  • Merchant ID
  • Currency
  • Order ID (Should be unique)

Session creation CURl

curl https://baiduri-bpgs.mtf.gateway.mastercard.com/api/nvp/version/46 -d "apiOperation=CREATE_CHECKOUT_SESSION" -d "apiPassword=ac35b2803b5ddb1b71442d0b3835e4fd" -d "interaction.returnUrl=http://localhost:53540/payment.html" -d "apiUsername=merchant.950028381" -d "merchant=950028381" -d "order.id=1234567892" -d "order.amount=100.00" -d "order.currency=BND"

Checkout configuring

Checkout.configure({
            merchant: '950028381',
            order: {
                amount: function () {
                    return 100;
                },
                currency: 'USD',
                description: 'Ordered goods',
                id: '1000'
            },
            interaction: {
                merchant: {
                    name: 'Hsenid Mobile',
                    address: {
                        line1: '200 Sample St',
                        line2: '1234 Example Town'
                    }
                }
            },
            session: {
                id: "SESSION0002838485787H0046572I02"
            }
        });

NOTE: Same Merchant ID, Currency, Order ID should be used at checkout configuration and session ID generation

Udara Seneviratne
  • 2,303
  • 1
  • 33
  • 49
  • machan, I'm trying to implement the combank mpgs for a small website. Do you have any documentation/case study for me to learn more about the integration process?. I have no prior experience in payment gateways. – Desper Jun 30 '19 at 11:07
  • @Desper Combank provides following documentation as their developer guide. https://test-gateway.mastercard.com/api/documentation/integrationGuidelines/index.html?locale=en_US – Udara Seneviratne Jul 01 '19 at 08:34