Order Query
This endpoint is for WeChatPay, Alipay and UnionPay only.
API Request
Endpoint
https://api.iotpaycloud.com/v1/query_order
Method
POST
Header
Content-Type: application/x-www-form-urlencoded
! Tip
After you receive access credentials (merchant id, login name, merchant key). You can step through the demo Query Order to test out the workflow for this functionality. Which may help you when going through the documentation.
Parameters
| Name | Required | Type | Sample | Description |
|---|---|---|---|---|
| mchId | y | String(30) | 1000000010 | merchant id assigned by IOTPay |
| payOrderId | y* | String(30) | P20160427210604000490 | order id assigned by third party payment system |
| mchOrderNo | y* | String(30) | 20160427210604000490 | order id assigned by merchant |
| sign | y | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | signature |
Note
Only one of payOrderId or mchOrderNo is needed for the query.
Return Result
| Name | Type | Sample | Description |
|---|---|---|---|
| retCode | String(16) | SUCCESS | SUCCESS/FAIL, retCode indicate communication status, need to check resCode for transaction |
| retMsg | String(128) | signature error | if not empty, it is error message |
The following fields will return if retCode is SUCCESS
| Name | Required | Type | Sample | Description |
|---|---|---|---|---|
| resCode | y | String(16) | SUCCESS | SUCCESS/FAIL |
| errCode | y | String(32) | SYSTEMERROR | error code |
| errCodeDes | y | String(128) | system error | error message |
The following fields will return if retCode and resCode are both SUCCESS
| Name | Required | Type | Sample | Description |
|---|---|---|---|---|
| mchId | y | String(30) | 20001222 | |
| mchOrderNo | y | String(30) | 20160427210604000490 | |
| channelId | y | String(24) | WX_JSAPI | |
| currency | y | String(3) | CAD | |
| amount | y | int | 100 | |
| clientIp | n | String(32) | 210.73.10.148 | |
| device | n | String(64) | WEB | |
| notifyUrl | y | String(200) | http://xxx.com/notify.php | |
| subject | y | String(64) | product title | |
| body | y | String(256) | product desc | |
| param1 | n | String(64) | ||
| param2 | n | String(64) | send the original value back | |
| extra | y | String(512) | {“openId”:”o2RvowBf7sOVJf8kJksUEMceaDqo”} | |
| paySuccTime | n | Long | 1505049094262 | payment success time |
| channelOrderNo | n | String | wx20170910211043fb206e92260071822007 | |
| status | y | int | 2 or 3 | order status, success: 2 or 3 |
Order Status
| Status | Description |
|---|---|
| 0 | created but not paid |
| 1 | user is paying, e.g. user is typing password |
| 2 | paid |
| 3 | paid and notified the merchant(if notifyUrl used) |
| 4 | cancelled by system |
| 9 | cancelled by user |
Note
When polling order status, only 2 or 3 is success, if status > 3, the order won't be success again, the polling can be stopped.
