In this WeChat public platform development tutorial, we will introduce how to develop and implement the network-wide publishing function of WeChat payment.
Network-wide release refers to the detection and release of the rights protection function, alarm interface, and delivery interface in the last step of the WeChat payment background.
This article is divided into the following three parts:
WeChat payment directory setting
Delivery interface adjustment
Adjustment of rights protection interface and alarm interface
1. WeChat payment directory setting
The setting of WeChat payment URL is closely related to the adjustment of WeChat payment. The several URL settings we use here are as follows:
Payment test URL: http://www.fangbei.org/wxpay/jsapi/index.php
Transaction notification URL: http://www.fangbei.org /wxpay/notify/index.php
Rights notification URL: http://www.fangbei.org/wxpay/rights/index.php
Alarm notification URL: http://www.fangbei.org/wxpay /alarm/index.php
2. Adjustment of the shipping interface
Before adjusting the shipping interface, the user needs to have a transaction before sending, so first Complete a jsapi payment, the code is as follows,
setParameter("bank_type", "WX"); $wxPayHelper->setParameter("body", "方倍微信支付测试"); $wxPayHelper->setParameter("partner", PARTNERID); $wxPayHelper->setParameter("out_trade_no", $commonUtil->create_noncestr()); $wxPayHelper->setParameter("total_fee", "1"); $wxPayHelper->setParameter("fee_type", "1"); $wxPayHelper->setParameter("notify_url", "http://www.fangbei.org/wxpay/notify/index.php"); $wxPayHelper->setParameter("spbill_create_ip", $_SERVER['REMOTE_ADDR']); $wxPayHelper->setParameter("input_charset", "GBK"); $biz_package=$wxPayHelper->create_biz_package(); ?>
When the above transaction is completed, the transaction notification interface will call back the URL with parameters, as follows
http://www.fangbei.org/wxpay/notify/index.php?discount=0&fee_type=1&input_charset=GBK¬ify_id=aCi-cg4m1nr2bbg-De-MK6hQum8XVsw4mYfYnD5umAiEm_J6P_MalPvOisl2NJdurzTW-TJ9IPcnKmZm5TpKjrc8bXT6PEe0&out_trade_no=5DlIL2s5DGR8147c&partner=1219951701&product_fee=1&sign=A7AEF7AE3B70C54C3C0FF642DD2E2004&sign_type=MD5&time_end=20140808185647&total_fee=1&trade_mode=1&trade_state=0&transaction_id=1219951701201408083366666764&transport_fee=0
At the same time, POST sent the following XML data
1 1407495408
Take out the
transaction_id=1219951701201408083366666764 out_trade_no=5DlIL2s5DGR8147c
in the url and the
in the xml and fill the above 3 parameter values into the delivery interface. For the code, please refer to WeChat Payment Development Delivery Notice
Run it once and the delivery notification interface will be opened.
3. Adjustment of the rights protection interface and the alarm interface
The adjustment of the rights protection interface and the alarm interface is very simple, because the official only needs to receive a response. Therefore, success is returned directly in the corresponding index.php. The code is as follows:
4. Effect diagram
After the above three interfaces are adjusted, it can be released to the entire network. The effect is as follows
#For more articles related to WeChat payment development published across the entire network, please pay attention to the PHP Chinese website!