Home >Backend Development >PHP Tutorial >Developing Alipay, Tenpay, and WeChat payment parameter errors based on OpenCart, opencart Pay_PHP tutorial
Recently integrating Alipay, Tenpay and WeChat scan code payment for OpenCart, in fact These plug-ins are available for sale, but they are quite expensive. It is better to develop and integrate them yourself to save money. However, some pitfalls were discovered during the integration process, including pitfalls with opencart and pitfalls with payment of SDK, which wasted a lot of time. Here are a few pitfalls for those who need them.
1. The notify_url address in WeChat native mode 2 must be a public address
2. Alipay’s notify_url cannot be in the form of query string, such as xxx/notify.php? route=a/b, can only be xxx/notify.php
3. In the synchronous callback processing in Alipay and Tenpay in OpenCart, it is best to unset ($_GET['route']) before doing payment callback verification, otherwise the callback verification will not be successful because this redundant parameter is involved in the verification.
4. When WeChat calls back notify, it sends a data stream, so GET and POST cannot obtain the data notified asynchronously after payment. When using the official SDK, you can change it like this:
$GLOBALS["HTTP_RAW_POST_DATA"] = file_get_contents("php://input", "r"); $notify = new PayNotifyCallBack(); $notify->Handle(false);
5. When accessing Alipay on PC browser with an ios device, the Alipay client will pop up for payment. In this way, asynchronous and synchronous notifications cannot be received, so you need to determine whether the access device is a mobile terminal or a client. If so, For mobile devices, you must use Alipay’s wap method to pay
6. Tenpay payment QQ browser payment always has wrong parameters, I haven’t found the reason yet.
Remind everyone to be careful when using OpenCart to develop Alipay, Tenpay, and WeChat payments. Thank you friends for paying attention to the Bangkejia website. Here, the editor of Script Scaffold wishes everyone a happy National Day.