Skip to content

RequestPayment

Signature

WeChat Pay APIs have two versions of signature: V2 and V3. Developers must use the correct version of the API and the corresponding signature to avoid errors like "Signature Mismatch".

API_V2

API_V3

Parameters

PropertyTypeDefault ValueRequiredDescription
mchIdstringYesMerchant ID
prepayIdstringYesPrepayment transaction session ID
nonceStrstringYesRandom string
packagestringYesRandom string, usually fixed value: Sign=WXPay
timeStampstringYesTimestamp
signstringYesSignature; Note: The signature method must match the one used in the unified order interface. V2 and V3 signatures are described above.

Example

javascript
window.Wechat.requestPayment({
    timeStamp: '1667792176',
    mchId: '1800009365',
    prepayId: 'wx07113616363804b19dde94884922030000',
    package: 'Sign=WXPay',
    nonceStr: '8ne443gjxxg',
    sign: '4FF5900870B5C5BCB089789BC004156426C46512CE566DB17C131747E09ADEBA'
  },
  function(res) {
    console.warn('requestPayment success:', res);
  },
  function(err) {
    console.error(err);
  }
);

Apache 2.0 License.