2.13在线支付统一下单

优质
小牛编辑
125浏览
2023-12-01
支付下单线下API接口协议

请求参数说明

参数描述必填示例值类型最大长度
action接口参数组object
└action需要调用的接口名称cash_unifiedorderstring
getGET参数组,本组参数需要参与签名object
postPOST参数组object
└id账单请求号(唯一不重复)721386328601451823number
└pay_type支付方式(wx、ali、xcx)wxstring
└appid微信公众号/小程序appidwxc0**********49e2string
└openid用户标识(微信openid,支付宝userid)o4kIe******************HAIjsstring
└notify_url支付结果通知地址https://www.dc78.cn/notify.htmlstring
└amt订单总金额,单位元,精确到小数点后两位88.00number
└detail对交易或商品的描述A01桌台账单string
└attach附加数据,原样返回string
└bill账单列表list
└└qty数量11number
└└amt小计(数量*单价)(元)33number
└└name商品名称农夫山泉string
└└desc单位描述瓶/001string
└└price单价(元)3number
└└id商品ID1000121number

请求示例

{
  "action": {
    "action": "cash_unifiedorder"
  },
  "get": {
    
  },
  "post": {
    "data": {
      "id": "20191024001",
      "pay_type": "xcx",
      "appid": "wxc0**********49e2",
      "openid": "o4kIe******************HAIjs",
      "notify_url": "",
      "amt": "88.00",
      "detail": "西瓜测试",
      "attach": "66666",
      "bill": [
        {
          "id": "1000121",
          "qty": "11",
          "amt": "33",
          "name": "农夫山泉",
          "desc": "瓶/001",
          "price": "3"
        },
        {
          "id": "1000122",
          "qty": "11",
          "amt": "55",
          "name": "雪碧",
          "desc": "罐/001",
          "price": "5"
        }
      ]
    }
  }

响应参数说明

参数描述必填示例值类型最大长度
status返回状态。接口成功时为1,出错为01number
trid渠道交易号101739406721619102410295506877number
appId微信/小程序 appidwx7b5814c3016dcffcstring
timeStamp时间戳1571884196number
nonceStr随机字符串4a41b4f654a54cc68f3fb2dcfada77acstring
signType签名类型RSAstring
paySign签名B1L2VGNcNtuDvL5w/OKjstring
package预支付交易会话标识prepay_id=wx2410295620910154b4727ce21020617900string
trade_no支付宝交易号2019102422001402301404028978number
payid果盘支付单流水号8601936808number
msid果盘门店编号6786number

响应示例

{
    "status":"1",
    "trid":"101739406721619102410295506877",
    "appId":"wx7b5814c3016dcffc",
    "timeStamp":"1571884196",
    "nonceStr":"4a41b4f654a54cc68f3fb2dcfada77ac",
    "signType":"RSA",
    "paySign":"B1L2VGNcNtuDvL5w/OKj",
    "package":"prepay_id=wx2410295620910154b4727ce21020617900",
    "trade_no":"2019102422001402301404028978",
    "payid":"8601936808",
    "server_timestamp":1571884196,
    "server_time":"2019-10-24 10:29:56",
    "server_name":"wx-task2.hz",
    "msid":"6786"
}

通知

参数中设置redirect_url后,支付成功将会跳转redirect_url地址

参数中设置notify_url后,支付成功将会POST一个JSON到此地址,JSON格式如下:

{ "payid":9817557,

"paylist":{

"pay_wx":118,

"pay_mc":0

}

}

notify_url收到支付回调后,需要返回一个JSON

{"state":1,

"info":"ok"}

参数参数名称描述
payid
平台支付流水号

type
支付方式
paylist
本次支付付款项目
pay_mc=微信支付,pay_ali=支付宝,pay_mc=会员卡,有可能会出现多个付款项目
payamt
支付金额

trade_no第三方支付流水号
attach附加数据,原样返回