capturing error messages from migs payment

主宰稳场 提交于 2019-12-13 15:23:58

问题


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:


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.



来源:https://stackoverflow.com/questions/24728281/capturing-error-messages-from-migs-payment

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