(MasterCard Virtual Payment Client) migs integration php

我只是一个虾纸丫 提交于 2019-12-11 05:14:27

问题


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:

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;

回答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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/30627256/mastercard-virtual-payment-client-migs-integration-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!