miniapp-creat new
POST {{base_url}}/api/v1/miniapp/orders
Create Order
Create Order API
| URL | /api/v1/miniapp/orders |
|---|---|
| Method | POST |
| Content-Type | application/json |
Create Order Request parameter
Create Order Body parameters
| Name | Location | Types | Required | instruction |
|---|---|---|---|---|
| merchantorderid | body | string | Yes | The unique order number used by the merchant |
| amount | body | number | Yes | How much to charge. add 00 for decimal.Example 150.50 THB amount =15050 |
| channel | body | string | No | Payment channel , Value range: alipay: Alipay Wallet. wechat: Wechat Wallet. |
| miniapp_openid | body | string | No | The openid of the applet user, the WeChat applet is openid |
| miniapp_appid | body | string | No | The appid of the Mini Program |
| timestamp | body | string | No | Timestamp |
| note | body | string | No | order notes |
| signature | body | string | Yes | Request signature |
Request body example Create WeChat Mini Program order
{
"amount": 85,
"merchant_order_id": "mc_1626164356",
"signature": "49B80F2A260918CF02081578B415D726B25417C1A6C7536FE5909834104F4752",
"timestamp": "1626164339",
"miniapp_openid": "oNUEf5TxzRxSvNSET1_2tfLa7gaE",
"miniapp_appid": "wx2181eee9ed4505ce",
"note": "Ozyktsgs pwikzq gbmiti rfokp yoiqu cutx uektskl dvk txocubkw yxzj gxnzu jhkjrvmtm hrcuq arobdp jhwheii mshyqgrad.",
"channel": "wechat"
}
Request body example Create Alipay applet order
{
"amount": 73,
"merchant_order_id": "mc_1626781393",
"signature": "49B80F2A260918CF02081578B415D726B25417C1A6C7536FE5909834104F4752",
"timestamp": "1626781393",
"note": "Pso moyn yhsud qwws xgujurs jlwh pptcgocy vbnlvrerof bjwkg rxhypf jnijurehu umqntfpay mfxsxwit ydcfnq sxct.",
"channel": "alipay"
}
Response result
- When the error_code is SUCCESS, the order creation is successful, and the interface returns the order details
Additional fields for order details when creating WeChat Mini Program orders
| Name | Types | Required | instruction |
|---|---|---|---|
| reference | string | Yes | The package field of WeChat applet payment parameters |
| reserved1 | string | Yes | The timeStamp field of the WeChat applet payment parameter |
| reserved2 | string | Yes | The signType field of the WeChat applet payment parameter |
| reserved3 | string | Yes | paySign field of WeChat applet payment parameters |
| reserved4 | string | Yes | The nonceStr field of the WeChat applet payment parameter |
Use the above fields to initiate payment in the WeChat Mini Program, refer to https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestPayment.html
Successful response example
{}
Additional fields for order details when creating an Alipay applet order
| Name | Types | Required | instruction |
|---|---|---|---|
| reference | string | Yes | The orderStr field of Alipay applet payment parameters |
Use the above fields to initiate payment in the Alipay applet, reference https://opendocs.alipay.com/mini/api/openapi-pay
Successful response example
{}
Request Body
{"amount"=>1, "merchant_order_id"=>"20220523101800", "note"=>"string", "miniapp_openid"=>"your miniapp_openid", "miniapp_appid"=>"miniapp_appid", "channel"=>"wechat", "timestamp"=>"2022051900", "signature"=>"{{signature}}"}