# 1. WebPay收款下单

# HTTP请求信息

# URL

{domain}/open-api/webpay/generate

# 请求方式

POST

# Content-Type

application/json

# 请求参数

参数名 是否必填 类型 说明
timestamp long 当前时间戳
channelCode string 渠道码(WebPay渠道码列表)
mchOrderId string 商户订单号,字母+数字,最大长度32
amount integer 金额,单位分
notifyUrl string 商户交易通知 URL
redirectUrl string 重定向 URL
customerName string 用户名,最大长度100
email string 用户邮箱
mobile string 用户手机号 正则表达式:0([689]\d{8})$
remark string 备注
expireSeconds integer 过期时间,单位秒,范围30~3600,默认3600
payerClientIp string - 当channelCode=WECHAT_URL时必传
- 用户侧设备IP,取公网出口IP,支持IPV6
wpOpenid string - 当channelCode=WECHAT_JS_URL时必传.
- 微信用户唯一标识
- 通过网页授权获取openid
wpAppid string - 当channelCode为以下值[WECHAT_JS_URL]时必传.
- 商户在微信开放平台申请移动应用对应的APPID
* 公众号支付使用商户公众号appid
* 小程序支付使用商户小程序appid

# 响应参数

参数名 类型 说明
mchOrderId string 商户订单号,字母+数字,最大长度32
payUrl string 还款链接
transactionId string 还款链接交易id
expiresTime string 过期时间
shortUrl string 微信公众号支付时通过该链接跳转支付收银台
metadata object 元数据
metadata.wechatpay object 微信调起支付需要用到的参数(根据调起支付的不同方式选择性使用对应参数)
metadata.wechatpay.prepayId string 预下单会话标识
metadata.wechatpay.appId string 微信公众号/小程序/app应用对应的appid
metadata.wechatpay.nonceStr string 随机字符串
metadata.wechatpay.pkg string 额外信息
metadata.wechatpay.paySign string 签名
metadata.wechatpay.signType string 签名方式
metadata.wechatpay.timeStamp string 时间戳

# 请求示例

如何构造请求体

# 请求体

{
  "appId": "6e2d4b6f926c44f8ab4e0f5c76cdec69",
  "sign": "tVa+aoAXH0ls1IoPznzkFyF+4v+iTZaCSttPWmYl1kCHeh8mwao8cqAD7Y7wdymcr9yavKh4bKT18KeLu27g7Q5GqhEQ0cm1dkARe+i2xoH32la4HAzBfPj9liULDawGoPbo739+FLgZnV79CLaiukvqtnkgI/Km6J/KccRPl2CtS4PUjxCyRicOAcv91KZiVOxyhoP9bKhvwtCkCIlkpBHKWskBPCxxfctoORjgXWj7FhRPLYBuRDaczfmr2um9aNXhVoH1XFZf7Gu67n6RmeB0kc2dHFPI89JEI0PwGq+bvbCAEUtHK4SlLexCtbMoCgGWKTJbSMDTvVF126jz8g==",
  "param": "{\"mchOrderId\":\"EXAMPLE00000001\",\"amount\":1000,\"customerName\":\"Jason\",\"channelCode\":\"TRUEMONEY_URL\",\"email\":\"jasonbourne@gmail.com\",\"mobile\":\"0612345678\",\"notifyUrl\":\"https://example.com\",\"redirectUrl\":\"https://google.com\",\"expireSeconds\":3600,\"timestamp\":\"1715099419\"}"
}

WECHAT_URL

{
  "appId": "6e2d4b6f926c44f8ab4e0f5c76cdec69",
  "sign": "tVa+aoAXH0ls1IoPznzkFyF+4v+iTZaCSttPWmYl1kCHeh8mwao8cqAD7Y7wdymcr9yavKh4bKT18KeLu27g7Q5GqhEQ0cm1dkARe+i2xoH32la4HAzBfPj9liULDawGoPbo739+FLgZnV79CLaiukvqtnkgI/Km6J/KccRPl2CtS4PUjxCyRicOAcv91KZiVOxyhoP9bKhvwtCkCIlkpBHKWskBPCxxfctoORjgXWj7FhRPLYBuRDaczfmr2um9aNXhVoH1XFZf7Gu67n6RmeB0kc2dHFPI89JEI0PwGq+bvbCAEUtHK4SlLexCtbMoCgGWKTJbSMDTvVF126jz8g==",
  "param": "{\"mchOrderId\":\"EXAMPLE00000001\",\"amount\":1000,\"customerName\":\"Jason\",\"channelCode\":\"WECHAT_URL\",\"email\":\"jasonbourne@gmail.com\",\"mobile\":\"0612345678\",\"notifyUrl\":\"https://example.com\",\"redirectUrl\":\"https://google.com\",\"expireSeconds\":3600,\"timestamp\":\"1715099419\",\"remark\":\"remark\",\"payerClientIp\": \"192.168.100.2\"}"
}

WECHAT_JS_URL

{
  "appId": "6e2d4b6f926c44f8ab4e0f5c76cdec69",
  "sign": "tVa+aoAXH0ls1IoPznzkFyF+4v+iTZaCSttPWmYl1kCHeh8mwao8cqAD7Y7wdymcr9yavKh4bKT18KeLu27g7Q5GqhEQ0cm1dkARe+i2xoH32la4HAzBfPj9liULDawGoPbo739+FLgZnV79CLaiukvqtnkgI/Km6J/KccRPl2CtS4PUjxCyRicOAcv91KZiVOxyhoP9bKhvwtCkCIlkpBHKWskBPCxxfctoORjgXWj7FhRPLYBuRDaczfmr2um9aNXhVoH1XFZf7Gu67n6RmeB0kc2dHFPI89JEI0PwGq+bvbCAEUtHK4SlLexCtbMoCgGWKTJbSMDTvVF126jz8g==",
  "param": "{\"mchOrderId\":\"EXAMPLE00000001\",\"amount\":1000,\"customerName\":\"Jason\",\"channelCode\":\"WECHAT_URL\",\"email\":\"jasonbourne@gmail.com\",\"mobile\":\"0612345678\",\"notifyUrl\":\"https://example.com\",\"redirectUrl\":\"https://google.com\",\"expireSeconds\":3600,\"timestamp\":\"1715099419\",\"remark\":\"remark\",\"wpAppid\": \"wx188888888\",\"wpOpenid\": \"xxxx\"}"
}

# 响应示例

响应码集合

{
  "code": 10000,
  "message": "Success",
  "data": {
    "payUrl": "https://tmn-dev.app.link/commoncashier?deeplink=ascendmoney%3A%2F%2Fwallet.truemoney.co.th%2Fapp%2F660000000012%3Ftype%3Dcommoncashier%26method%3De8cc7c8bcc5a189239a1b5e0e31d8f98",
    "transactionId": "C1218702956934697612",
    "mchOrderId": "EXAMPLE00000001",
    "expiresTime": "2023-12-31 23:00:00"
  }
}

WECHAT_URL

{
  "code": 10000,
  "message": "Success",
  "data": {
    "payUrl": "https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx021748099116920dc3ea1127bf59690001&package=392765581&redirect_url=https%3A%2F%2Fwww.example.com",
    "transactionId": "C50807510000001",
    "mchOrderId": "myH5testExample001",
    "expiresTime": "2024-07-02 16:53:10"
  }
}

WECHAT_JS_URL

{
  "code": 10000,
  "message": "Success",
  "data": {
    "payUrl": "wx2818342971009762fb53a55e214b260001",
    "transactionId": "C50807510000001",
    "mchOrderId": "myJStestExample001",
    "expiresTime": "2024-06-28 17:44:27",
    "shortUrl": "https://bluepaycashier.upay365.xyz/payment/wechat/inner/5znSRaH5YMrNBcKNnMnPFQ==?redirect_url=https://www.baidu.com",
    "metadata": {
      "wechatpay": {
        "prepayId": "wx2818342971009762fb53a55e2100000001",
        "appId": "wx188888888",
        "nonceStr": "xu8Eu3dCf9xJhsuXB3Qw3DzWaZQQneF9",
        "pkg": "prepay_id=wx2818342971009762fb53a55e2100000001",
        "paySign": "QMPx1lhhYbuvTBEr05ACFIlJlZWBGpaM4wGNTA+lF0rVMcRmCdX2ORfIjONojYSpvvflicpjtgVLpc4tlw8AtUSPZjc7KIH59EoodnyvxVA3dqSu11FathGi6b1h4l+GdcqC/FeyxMm0Hfq6bWhzNWMra06U3Z/0sowaQTDT44tThYdbqhBEv2Iz/QsK307XZPSwKhjblaAAkmi+JQxokMeLgHBeWDGH3z92aowWxt0lbV++8hsZpmeEgzwx3GwStbOqZ4INoXodgvC5kO5ND38tnEsegrNm/JztlSY44DqPNXIhlxMCDvVDwI83jO2Fj9ndj1utGdL5w/E2k7v8sA==",
        "signType": "RSA",
        "timeStamp": "1719570870"
      }
    }
  }
}