MIGS payment integration with PHP gives 400 HTTP error-ThrowExceptions

Exception or error:

I have used the following code to integrate MIGS payment in my php website. I have taken the sample from the http://codezonecharitha.blogspot.com/2011/09/hsbc-migs-payment-gateway-integration.html and have used in my webpage.

    $accessCode    =  'B600004';//value from migs payment gateway//test value
    $merchantId    =  '200000000023';//value from migs payment gateway//test value
    $paymentdata = array(
             "vpc_AccessCode" => $accessCode,
             "vpc_Amount" => 10,//($_SESSION['amount']*100),//our product price , must multipy by 100
             "vpc_Command" => 'pay',
             "vpc_Locale" => 'en',// order id
             "vpc_MerchTxnRef" => $_SESSION['order.id'],
             "vpc_Merchant" => $merchantId,
             "vpc_OrderInfo" => "Online payment",
             "vpc_ReturnURL" => "https://10.0.1.100/?load=parents/pay/receipt",//here code for db updation, return variable here
             "vpc_Version" => '1'
                       );

    $actionurl = 'https://migs.mastercard.com.au/vpcpay' . "?";
    $HashData = $SECURE_SECRET;
    $appendAmp  = 0;
    foreach ($paymentdata as $key => $value) {
        // create the md5 input and URL
        if (strlen($value) > 0) {
            // this ensures the first paramter of the URL is preceded by the '?' char
            if ($appendAmp == 0) {
                $actionurl .= urlencode($key) . '=' . urlencode($value);
                $appendAmp  = 1;
            } else {
                $actionurl .= '&' . urlencode($key) . "=" . urlencode($value);
            }
            $HashData .= $value;
        }
    }
    if (strlen($SECURE_SECRET) > 0){$actionurl .= "&vpc_SecureHash=" . strtoupper(md5($HashData));}
   }   

   HTML:
   <form method="POST" id="form_pay" action="<?php echo $actionurl;?>">
   <input type="submit" name="save">
    </form> 

   Jquery:
    <script>
      $(function(){
        $(document).find('#form_pay').submit(); 
        });
   [enter image description here][1]</script> 

I am submitting the form automtically .I got the following error when submitted:HTTP 400 error Image

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *