miniapp-creat new

POST {{base_url}}/api/v1/miniapp/orders

Create Order

Create Order API

URL/api/v1/miniapp/orders
MethodPOST
Content-Typeapplication/json

Create Order Request parameter

Create Order Body parameters

NameLocationTypesRequiredinstruction
merchantorderidbodystringYesThe unique order number used by the merchant
amountbodynumberYesHow much to charge. add 00 for decimal.Example 150.50 THB amount =15050
channelbodystringNoPayment channel , Value range:
alipay: Alipay Wallet.
wechat: Wechat Wallet.
miniapp_openidbodystringNoThe openid of the applet user, the WeChat applet is openid
miniapp_appidbodystringNoThe appid of the Mini Program
timestampbodystringNoTimestamp
notebodystringNoorder notes
signaturebodystringYesRequest 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
NameTypesRequiredinstruction
referencestringYesThe package field of WeChat applet payment parameters
reserved1stringYesThe timeStamp field of the WeChat applet payment parameter
reserved2stringYesThe signType field of the WeChat applet payment parameter
reserved3stringYespaySign field of WeChat applet payment parameters
reserved4stringYesThe 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
NameTypesRequiredinstruction
referencestringYesThe 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}}"}