capturing error messages from migs payment

2019-07-16 05:36发布

I'm having issues with my MIGS Payment facility that I created for my website. When the user encounters errors with the migs server (payment did not run successfully), how do I know if it encountered such error?

These are the parameters I used(replaced my link with a sample link):

"vpc_Amount" => ($amount*100),
                 "vpc_Command" => 'pay',
                 "vpc_Locale" => 'en',// order id
                 "vpc_MerchTxnRef" => $session_id,
                 "vpc_Merchant" => $merchantId,
                 "vpc_OrderInfo" => "Test order",
                 "vpc_ReturnURL" => "http://mywebsite.com/returnUrL",
             "vpc_Version" => '1'

How do I know if it failed, since either a payment successful or a payment failure happens, it goes to the same returnURL. Can I set another link wherein it would go there if the transaction failed?

1条回答
姐就是有狂的资本
2楼-- · 2019-07-16 06:07

As stated in the VPC Manual - "The Transaction Response is returned to your website using an Internet browser redirect as specified in the vpc_ReturnURL field. The DR will always have a secure hash for the online store to check data integrity."

Basically it throws a $GET variable named vpc_TxnResponseCode where-in:

The merchant application receipting function needs to be able to calculate the secure hash signature in the Transaction Response to determine if the signature received is valid for the receipt data. It has to handle:
• Incorrect secure hash signatures
• Successful transactions
• If vpc_TxnResponseCode code is equal to '0' then the transaction was completed successfully and you can display a receipt to the cardholder.
• Declined transactions
• If vpc_TxnResponseCode is equal to '1', '2', '3', '4', or '5' the transaction has been declined and this needs to be conveyed back to the cardholder.
• Error Conditions –
• If vpc_TxnResponseCode equals '7' or '8' an error has occurred
• Other values may also indicate an error has occurred
• Further details for error conditions can be gathered by examining the vpc_Message field so a decision can be made as to the next step.
All four of these conditions are responses that can be returned from the Virtual Payment Client.

I hope this helps others who are also developing application using MIGS. I was lucky a friend was able to give me this resource after I told him that I was looking for answers regarding responses from MIGS.

查看更多
登录 后发表回答