Skip to content

微信小程序支付

公共参数

参数类型是否必填最大长度描述示例
mch_noString32商户号2014072300007148
methodString128接口名称,如果是小程序跳小程序用前者(trade.wechat.mini.pay),如果是 APP 或者 H5 跳小程序用后者(trade.wechat.mini.h5.pay)trade.wechat.mini.pay 或 trade.wechat.mini.h5.pay
charsetString10调用的接口版本,固定为:utf-8utf-8
sign_typeString10商户生成签名字符串所使用的签名算法类型,目前支持 RSARSA
signString344商户请求参数的签名串详见示例
timestampString19发送请求的时间,格式"yyyy-MM-dd HH:mm:ss"2014-07-24 03:07:50
versionString3调用的接口版本,固定为:1.01.0
notify_urlString200异步通知地址,200 个字符之内http://localhost/notify.html
return_urlString200同步跳转地址,200 个字符之内http://localhost/return.html
biz_contentString业务参数

业务参数

参数类型是否必填最大长度描述示例
out_trade_noString必选64商户订单号。由商家自定义,需保证在商户端不重复。20150320010101001
total_amountNumber必选11订单总金额。单位为元,精确到小数点后两位。88.88
subjectString必选256订单标题。Iphone6 16G
client_ipString必选32客户端 IPV4 地址。127.0.0.1
app_idString128商户小程序 appidwxsssdfsfsfsdfsdf
divide_typeString可选25用户如果要手动分账,参数固定传 DELAY_SETTLEDELAY_SETTLE
payer_idString128支付用户的 openidasdasdasdasd

使用 APP 或者 H5 跳转小程序的返回参数

参数类型描述
codeInt20000
messageStringsuccess
qrcode_urlString跳转(APP,H5 场景)或者扫码(PC 场景,慎用,可能不跳转)链接
signString签名字符串

使用小程序跳转小程序的返回参数

参数类型描述
codeInt20000
messageStringsuccess
pathString小程序跳转页面链接,带参数
appIdString小程序 appid
basePathString小程序跳转页面链接
orgIdString小程序需要的 orgId
signString签名字符串

示例代码

json
H5 和 APP 场景的小程序返回结果如下:
{
"code": 20000,
"msg": "success",
"out_trade_no": "ff222222202222",
"total_amount": "38.88",
"trade_no": 595648781137768448,
"qrcode_url": "https://img.yeepay.com/fe-resources/html/redirectTest.html?redirectUrl=https%3A%2F%2Fyunkaifa-1gn6er8qec364121-1317582238.tcloudbaseapp.com%2Fjump-mp-v1.html%3Fstate%3D42496438-ceed-4cf5-8152-9562658188d2%26customerNo%3D10089645136%26goodsName%3D%25E6%25B5%258B%25E8%25AF%25951%26customerRequestNo%3D595648781137768448%26orderAmount%3D38.88",
"sign": "BQfLxHlw+G8i0KoYt4sMNcLFSyj+YR5xb54zUQCAEyj5zmJIr0gKqRhdxz8ORhR9vyygKvLqBDMVomSQjRQ7alkN/OlQs9rKi+w3diBCEBtqHDqDcawpiZaSFkIHDmoaP+Wj2u5NtVs1rTr1Wa8PtZ1kLQaAe6ipDD24J8Qczv7pbU0LqeGYkGqA+ckk4aGnyw7oSIU6gnpZCBvd7fP3QrhNZ7sAFm2kLmQKcmNIfwNy3uVXvdonhuJ+p7uk8aHlJw8XhgSYFEte2Z1jERmLfJYgQSP8xm/Y+xuPHjNNbHJqlgpzg2ke0IuXl7QleV5zd/yV3Hu8DumXSMoz+5EglQ=="
}