The official document:
https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7
https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestPayment.html
Once the order is assumed that data is sent to the background, here is the return of the payment interface
{ "return_code": "SUCCESS", "return_msg": "OK", "appid": "wxd678efh567hg6787", "mch_id": "12345678", "nonceStr": "5K8264ILTKCH16CQ2502SI8ZNMTM67VS", "paySign": "22D9B4E54AB1950F51E0649E8810ACD6", "result_code": "SUCCESS", "packageValue": "prepay_id=wx2017033010242291fcfe0db70013231072", "timeStamp": "1490840662" }
After obtaining the relevant data to initiate micro-channel pay
wx.requestPayment ({ timeStamp: payParam.timeStamp.toString (), // 1490840662, timestamp nonceStr: payParam.nonceStr, // 5K8264ILTKCH16CQ2502SI8ZNMTM67VS, not longer than a 32-bit random string Package: payParam.packageValue, // Package Format: prepay_id = wx2017033010242291fcfe0db70013231072, orders returned interface prepay_id, pre-paid transaction session identifier signType: 'MD5', // signature algorithm type, default MD5, HMAC-SHA256 support and MD5 paySign: payParam.paySign, // signature, assumes that stitching detail signature format below success: function (RES) { console.log ( "payment process success" ); }, Fail: function (RES) { the console.log ( "payment process failed" ); }, Complete: function (RES) { the console.log ( "payment process ends" ); }
Specific signature schemes see: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=4_3
paySign格式:paySign = MD5(appId=wxd678efh567hg6787&nonceStr=5K8264ILTKCH16CQ2502SI8ZNMTM67VS&package=prepay_id=wx2017033010242291fcfe0db70013231072&signType=MD5&timeStamp=1490840662&key=qazwsxedcrfvtgbyhnujmikolp111111) = 22D9B4E54AB1950F51E0649E8810ACD6
Comment:
The 1.paySign key set for the key business platform for key
2.key set the path: micro-channel merchant platform (pay.weixin.qq.com) -> Account Settings -> API Security -> Key Settings