Micro-channel pay - a small number of public programs H5 Payment SDK

Foreword

2020 Today is a day last month to develop the order and payment system last year, especially at the time of payment systems and micro-channel docking encountered many pits, everyone here to summarize, lest they encounter the same problem also waste a lot of time

Micro-channel payment preparatory

  1. No micro-channel business, need 商户号, 密码need time refund 证书, the default password is the merchant certificate number
  2. WeChat app (such as a micro-channel or micro-channel applets public number) and appsecret appid
  3. Applet needs to be associated micro-channel micro-channel public number and then confirm the business operators in.
    Thus micro-channel pay preliminary work completed

    Payment

    SDK encapsulates a lot of micro-channel pay Alipay CUP and other
    git address https://github.com/Essensoft/Payment

    H5 micro-channel using the embedded applet that completes payment letter

    Because of the long hair applet version of the audit cycle, Division I h5 embedded mode (webview)
    to achieve is very simple, use jssdk from H5 jump to the applet page, evoke payment, after the payment is complete, then jump back to h5

1. Get accessToken
2. accessToken holding ticket acquisition (tickt)

Two hours are effective, propose to inject singleton object, get each time, the interceptor can be determined expiration time

3.jssdk introduced h5 need to initialize is wx.config need to initialize successfully to utilize the functionality provided him

This problem has been reported that the signature is invalid I spent four days full four days ah. With those solutions available online, there is no problem on my side of the URL to be wx.config encode then decode the interface in the background, in the development process without having to configure any https micro letter backstage or something.

4. Then call back after h5 interface pre-payment successfully, wx.miniProgram.navigateTo({ url: path });to the native small program launchedwx.requestPayment

At this point you can complete the payment

Micro-channel public number

pending upgrade

Guess you like

Origin www.cnblogs.com/gudanshiyigerendekuanghuan/p/12128570.html