# wx.miniapp.requestPayment

App Switch on WeChat Pay

# Precautions before Access

Read the following instructions in detail before accessing the payment:

# Notes on WeChat Pay Signature

  • WeChat Pay Api And the signature is V2 and V3 Two versions, the developer needs to use the correct version of the Api And the corresponding signature before it can be called properly, otherwise it will appearSignature inconsistencyError reporting
  • use

# API_V2

# API_V3

# parameter

  • Parameter alignmentWeChat Pay - App to pay.Parameters, easy to understand
  • The case of the parameter is the same as the case of the parameterWeChat Pay - App to pay.alignment
  • In addition, inWeChat Pay - App to pay.There is also a appid Parameter, which does not need to be passed by the developer in this interface, and the base library automatically assigns the mobile application to which the multi-terminal application is bound appid Passed to the paying side
attribute type Default value Required Introductions
mchId string yes Merchant No.
prepayId string yes Prepaid Transaction Session ID
nonceStr string yes Random character string
package string yes Random character string, temporarily fill in the fixed value Sign = WXPay
timeStamp string yes timestamp
sign string yes autographNote: the signature method must be consistent with the use of the unified single interface, only support V3 The signature of the

# Examples of code

    wx.miniapp.requestPayment({
      timeStamp: '1667792176',
      mchId: '1800009365',
      prepayId: 'wx07113616363804b19dde94884922030000',
      package: 'Sign=WXPay',
      nonceStr:  '8ne443gjxxg',
      sign: '4FF5900870B5C5BCB089789BC004156426C46512CE566DB17C131747E09ADEBA',
      success: (res) => {
        console.warn('wx.miniapp.requestPayment success:', res)
      },
      fail: (res) => {
        console.error('wx.miniapp.requestPayment res:', res)
      },
      complete: (res) => {
        console.error('wx.miniapp.requestPayment res:', res)
      }
    })

# Some Common Questions

# The merchant passed in an incorrect appid parameter

  • If there is an error below, please follow the ideas below to check your own
  • First, the screenshot in the appid Refers to theAppid for Transfer Application, not to mentionMultiterminal application idAnd in multi-tier applications, mobile applications appid There is no need for developer pass in this interface, the base library will automatically bind the mobile application to the multi-terminal application appid Passed to the paying side
  • The developer must first confirm.Multiterminal application - Mobile applications - Merchant No.Whether the binding of the three is correct
  • Can be found atWeixin DevTools - Multiterminal Application Mode - DetailsSee the multi-application. id And Mobile Apps appid information
  • Can be found atWeChat Open Platform - Mobile applications - detailsThere to see the bound merchant number information (or WeChat payment merchant platform where to see the bound mobile application account information)
  • The final caveat is that you must build the installation package to test on the phone, and you cannot use the mobile app assistant to test.
# tips
  • If you are looking for WeChat PayTechnical support, you can send the corresponding order interface and signature document to the payment side, do not send this interface document address to the payment side
  • Usually, to WeChat Pay to seekTechnical support, they need access to your mobile app appid , and the package name, signature, bundleid configured on the migration application account Such information, as well as your business number information, easy to help locate the problem
  • In addition, they will ask for the address of the relevant interface document, which you canWeChat Pay - App to pay.Documents sent to them, and the corresponding v2 and V3 The order interface and signature document link can be sent to them