API Explanation

Request Type

POST

Request URI

/api/v1/pay/weixin/mapp-pay

Request

ParameterTypeRequiredDescriptionRemark
appIdStringYesWeChat appId
openIdStringYesWeChat openIdThe user openId obtained in the WeChat mini app
amountStringYesTransaction Amountcent is the unit, “100” means a dollar
callbackURLStringYesCallback URLSend notifications to this URL when an order is complete (Maximum length 255 English characters)
remarkStringNoRemarkRemark(Maximum length with 128 English characters)

Request Example:

{
  "appId": "wx2f194e1f2a4e1645",
  "openId": "owv3d1fnMx1IpB6dWL7pK3TmJhBe",
  "amount": "100",
  "callbackURL": "https://your.callback.url",
  "remark": ""
}

Response

ParameterTypeDescriptionRemark
payInfoStringPayment Parameters
merchantIdStringMerchant ID
paymentIdStringPayment ID
amountStringTransaction Amount

Response Example:

{
  "status": "SUCCESS",
  "result": {
    "payInfo": "{\"appId\":\"wx53949a5b7cda9226\",\"timeStamp\":\"2023030612\",\"nonceStr\":\"Qga4FuDEVFlEr13C\",\"packageStr\":\"prepay_id\\u003dwx07010712646422b84dfd8c4e7844f50000\",\"signType\":\"MD5\",\"paySign\":\"18F34642E2DB3F7A5978C9F77AA3EE60\"}",
    "merchantId": "AB00000004",
    "paymentId": "1678122425666817",
    "amount": null
  }
}

Among them, payInfo contains the following data in JSON format, which is required by the front-end to complete the payment

{
  "appId": "wx53949a5b7cda9226",
  "timeStamp": "2023030612",
  "nonceStr": "Qga4FuDEVFlEr13C",
  "packageStr": "prepay_id=wx07010712646422b84dfd8c4e7844f50000",
  "signType": "MD5",
  "paySign": "18F34642E2DB3F7A5978C9F77AA3EE60"
}