微信小程序支付接口

[!TIP] 调起小程序支付需要在“微信公众平台|小程序”—设置—配置request合法域名

接口名称

openapi.payment.order.mina

请求方式

POST

请求头

application/json; charset=utf-8

请求业务参数

参数 类型 是否必填 最大长度 描述
merchant_order_sn string 32 第三方商户的订单号,请确保同一商户号下订单号唯一,前后不允许带空格
sub_openid string 32 小程序授权接口返回的sub_openid
total_fee float 10 订单金额(元)
store_id int 10 门店ID(一个商户下可有多个门店)
cashier_id int 10 收银员ID
call_back_url string 256 支付成功后异步通知链接
body String 128 对交易或商品的描述(微信上body值显示在商品,支付宝上body值显示在商品说明)
attach string 127 附加字段
  • 请求示例:

    {
    "biz_content": "{\"attach\":\"\订\单:123456\",\"store_id\":3239,\"merchant_order_sn\":\"201709191514852712155\",\"total_fee\":0.01,\"sub_openid\":\"oODbw0Aiss8lP5aPvFq9-_F4H9LA\",\"cashier_id\":\"34566\",\"body\":\"abcd\"}",
    "method": "openapi.payment.order.mina",
    "format": "json",
    "sign_method": "md5",
    "sign": "7FF51930705AF5624F32473647251584",
    "app_id": "20170601202131300809",
    "nonce": "201709081504852752642nonce",
    "version": "1.0"
    }
    
  • 成功响应参数

参数 类型 是否必填 最大长度 描述
prepay_id string 32 预支付订单号
order_sn string 32 付呗订单号
merchant_order_sn string 32 第三方订单号
sign_params json 32 小程序支付签名包(参见https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=5#) 备注:发起小程序支付请务必使用我司提供的签名包
cashier_id int 16 付呗系统的收银员id
user_id string 32 微信顾客支付授权的“open_id”或者支付宝顾客的“buyer_user_id”
  • 响应示例:
{
  "result_message": "成功",
  "data": {
      "prepay_id": "wx20170911132254c8d30e59860257709321",
      "order_sn": "20170911132248098178",
      "merchant_order_sn": "201709191504852712157",
      "sign_params": {
          "appId": "wxab93d4b3b6938cd7",
          "timeStamp": "1505107369",
          "nonceStr": "59b61da935ba4",
          "package": "prepay_id=wx20170911132254c8d30e59860257709321",
          "signType": "RSA",
          "paySign": "32F2E42CA0B883B3D36C4445645ECF70",
          "store_id": 123456,
          "cashier_id": 123456,
          "user_id": ""
      }
  },
  "result_code": 200
}
  • 失败响应参数
参数 类型 是否必填 最大长度 描述
result_message string 32 付呗错误信息
result_code int 3 付呗错误码
sub_code string 不定 平台方错误错误码
  • 失败响应示例:
    {
    "result_message": "订单创建失败",
    "result_code": 400,
    "sub_code":"ERROR_MES"
    }
    

results matching ""

    No results matching ""