1

I am trying to implement migs gateway from Axis bank to accept online payments but i am facing issues in intergerating with website in PHP.

I read many tutorials on Google and finally found a solution that atleast takes me to Master Card page but i am getting error on Landing page of MIGS gateway. Error in below Pic:

enter image description here

The migs Integeration used is

$SECURE_SECRET =  "****************"; //value from migs payment gateway
    $accessCode    =  "********";//value from migs payment gateway
    $merchantId    =  "********";//value from migs payment gateway
    $unique_id = rand(8888888,999999);
    $paymentdata = array(
             "vpc_AccessCode" => $accessCode,
             "vpc_Amount" => ("100"),
             "vpc_Command" => 'pay',
             "vpc_Locale" => 'en',
             "vpc_MerchTxnRef" =>  "ODID".$unique_id,
             "vpc_Merchant" => $merchantId,
             "vpc_OrderInfo" => "Some Comment",
             "vpc_ReturnURL" => "htps://localhost/test/success.php",
             "vpc_Version" => '1'
                       );
    ksort($paymentdata);
    $actionurl = 'https://migs.mastercard.com.au/vpcpay?';
    $HashData = $SECURE_SECRET;
    $str = 0;
    foreach ($paymentdata as $key => $value) {
        // create the md5 input and URL
        if (strlen($value) > 0) {
            if ($str == 0) {
                $actionurl .= urlencode($key) . '=' . urlencode($value);
                $str = 1;
            } else {
                $actionurl .= '&' . urlencode($key) . "=" . urlencode($value);
            }
            $HashData .= $value;
        }
    }

    if (strlen($SECURE_SECRET) > 0){$actionurl .= "&vpc_SecureHash=" . 
      strtoupper(md5($HashData));}
    //header("Location: " . $actionurl);
    echo $actionurl;
Gags
  • 3,759
  • 8
  • 49
  • 96

3 Answers3

1

It looks like the payment gateway is checking the return url you submit for validity.

  "vpc_ReturnURL" => "htps://localhost/test/success.php"

If you provide a valid, publicly accessibly URL, this error should be resolved.

Sam Dufel
  • 17,560
  • 3
  • 48
  • 51
0

Try to sort array $paymentdata (ascending by $keys). Then pass this sorted array to create HASH. And remember to have vpc_MerchTxnRef unique.

Othere than this your code seems ok.

Language Lassi
  • 2,520
  • 21
  • 24
0

try remove the urlencode():

if ($str == 0) {
    $actionurl .= $key . '=' . $value;
    $str = 1;
 } else {
    $actionurl .= '&' . $key . "=" . $value;
 }

When I was trying to upgrade to SHA256, the urlencode() did cause the 400 error.

Danh
  • 5,916
  • 7
  • 30
  • 45
KGGG
  • 36
  • 5