Vue project uses WeChat public account summary and encountered pit

WeChat public account payment

1. Use JSSDK to call WeChat payment, specifically view the development document;

Used Vuex, in Mutations

 WeChatpay (State, Data) {state.payObject = data console.log ('WeChat payment start request') if (weChat) {wx.choosewpay ({TimeStamp: state.payObject.timestamp , // Payment Sign Time Stamp Noncestr: State.PayObject.noncestr, // Payment Signature Random Skewers, Not Long 32 Bit Package: State.PayObject.Package, // Unified Payment Interface Return PREPAY_ID Parameter SIGNTYPE: State.PayObject. SIGNTYPE, // Signature Ways Use the new version of the payment to pass on 'MD5' pays: state.payObject.paysign, // payment sign Success: function (res) {Alert ('Success') Alert (Json.Stringify (res))} Cancel: Function (RES) {Alert ('has been canceled ") Alert (json.stringify (res)}}, fail: function (res) {Alert (json.stringifyRES)}})}}   Commix Commits 

// store WeChat payment data DATA Let data = res. body.data console.log (‘is about to jump WeChat payment’) this. $ store.commit ({TimeStamp: Data.TimeStamp, Noncestr: Data.noncestr, Type: ‘Wechatpay’, package: data. Package, SIGNTYPE: DATA.SIGNTYPE, PAYSIGN: DATA.PAYSIGN}
2. After paying the click completion button, the front end will receive the return value of JavaScript;
  3. Received payment success callback notification from WeChat open platform  

1. ChoosewxPay: fail, The Permission value is Offline verifying

This is not to test on WeChat developer tools, require real machine testing

2. ChoosewxPay: Fail

To configure the correct payment authorization directory, Vue’s single page application is directly configured to dominate.

Other need to be configured to call the previous level directory to / end

3. The order account and the payment account are inconsistent

Requires background Look at OpenID configuration

Summary

The above is the VUE project introduced to you. The WeChat public account is summarized. I hope to help everyone. If you have any questions, please leave a message, small The newspaper will reply to everyone in time. Thank you very much for your support of Tumi Cloud Website!


© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment