# 1. WebPay Create

# HTTP request info

# URL

{domain}/open-api/webpay/generate

# Request Method

POST

# Content-Type

application/json

# Request Parameters

parameter name required type of data description
timestamp Yes long current timestamp
channelCode Yes string channel code(WebPay ChannelCode List)
mchOrderId Yes string merchant order ID, alphanumeric, max length 32
amount Yes integer amount, the unit is cent
notifyUrl Yes string merchant payment notification URL
redirectUrl Yes string payment redirectUrl URL
customerName Yes string customer name, max length 100
email Yes string customer email address
mobile Yes string customer mobile phone number regex: 0([689]\d{8})$
remark No string remark
expireSeconds No integer expiration time,unit is second,from 30 to 3600,default is 3600
payerClientIp No string - required when channelCode=WECHAT_URL.
- the IP of the user's device, which is the public network egress IP and supports IPV6
wpOpenid No string - required when channelCode=WECHAT_JS_URL.
- the unique user ID corresponding to the appid of wechat platform.
- get WechatPay's Openid by Webpage Authorization
wpAppid No string - required when channelCode is in the list of [WECHAT_JS_URL].
- APPID corresponding to the mobile app applied for on the WeChat Open Platform.
* When Wechat Official account payment, please use appid of the merchant’s official account.
* When Wechat Mini program payment, please use the appid of the merchant’s mini program.

# Response parameters

parameter name type of data description
mchOrderId string merchant order ID, alphanumeric, max length 32
payUrl string order payment link
transactionId string transaction ID
expiresTime string expiration time
shortUrl string used to call payment in the situation of wechat official account payment
metadata object metadata
metadata.wechatpay object metadata of wechatpay, which is used to call payment
metadata.wechatpay.prepayId string Prepayment session ID generated by WeChat
metadata.wechatpay.appId string Appid of merchant's wechat official account/mini program/app
metadata.wechatpay.nonceStr string Random string
metadata.wechatpay.pkg string An extension string for order details
metadata.wechatpay.paySign string Signature
metadata.wechatpay.signType string Signature Method
metadata.wechatpay.timeStamp string Timestamp

# Request example

How to construct request body

# Request body

{
  "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\"}"
}

# Response example

code collection

{
  "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"
      }
    }
  }
}