6.Food Order Push Interface
Brief Description
- After a user places an order, the order information is pushed through this interface
Callback Trigger Timing
| Trigger Scenario | Description |
| Payment Successful | Triggered when order payment status changes from "Unpaid" to "Paid" |
| Refund Successful | Triggered when order payment status changes from "Refunding/Refund Pending" to "Refunded" |
Callback URL Configuration
Contact the operation staff of swifood
| Configuration Item | Description |
| Protocol Support | HTTPS (Recommended) / HTTP |
Request Method
| Parameter Name | Required | Type | Description |
| Content-Type | Yes | string | application/json |
Request Body Parameters
| Parameter Name | Required | Type | Length Limit | Example | Description |
| param | Yes | string | - | - | Parameter body |
| sign | Yes | string | - | 45eebd745dcf0b5f6d6f9fcde28cd9fe8116a892 | Signature |
| storeKey | Yes | string | - | - | Restaurant key |
| appId | Yes | string | - | - | APPID |
param Parameters
| Parameter Name | Required | Type | Length Limit | Example | Description |
| orderInnerNo | Yes | string | - | CCP20220428011068111 | Order No |
| restaurantNo | Yes | string | - | dasddasd | Restaurant No |
| branchIdentifier | Yes | string | - | dasddasd | Third-party store identifier |
| orderSerialNumber | Yes | Integer | - | - | Order serial number |
| channelCode | No | string | - | - | Payment channel code |
| channelName | No | string | - | - | Payment channel name |
| payProductType | No | Integer | - | - | Payment product type: 0-Offline 1-PaymentLink 2-BillPayment 3-BankTransfer 4-QrStatic 5-QrDynamic 6-Cpm 7-Balance |
| discountAmount | No | Integer | - | - | Merchant discount amount |
| fee | No | Integer | - | - | Online payment handling fee |
| serviceFee | No | Integer | - | - | Service fee |
| packageFee | No | Integer | - | - | Packaging fee |
| deliveryFee | No | Integer | - | - | Delivery fee |
| merchantDeliveryFee | No | Integer | - | - | merchant Delivery Fee |
| lessVat | No | Integer | - | - | Special discount tax-free amount |
| surcharge | No | Integer | - | - | Surcharge |
| realAmount | Yes | Integer | - | - | Actual payment amount |
| totalAmount | No | Integer | - | - | Total amount |
| orderStatus | Yes | Integer | - | - | Order status 1-Pending acceptance 2-Accepted 3-Completed 4-Cancelled |
| paymentStatus | Yes | Integer | - | - | Payment status 1-Unpaid 2-Paid 3-Payment failed 4-Refunding 5-Refunded 6-Refund pending 7-Refund failed 8-Cancel refund |
| customerNum | No | Integer | - | | Number of diners |
| createTime | Yes | String | - | | Order creation time Format: yyyy-MM-dd HH:mm:ss |
| completeTime | No | String | - | | Order completion time Format: yyyy-MM-dd HH:mm:ss |
| paymentTime | Yes | String | - | | Payment time Format: yyyy-MM-dd HH:mm:ss |
| receiptNo | Yes | String | - | | Payment invoice No |
| refundTime | No | String | - | | Refund time Format: yyyy-MM-dd HH:mm:ss |
| refundReceiptNo | No | String | - | | Refund invoice No |
| discountType | No | Integer | - | | Discount type 1-pwd 2-Merchant custom discount 3-pwd discount-per person 4-sc discount-entire order 5-sc discount-per person 6-Coupon |
| skuList | Yes | list | - | 1 | Order dish data |
| remark | No | string | - | Remarks | Remarks |
skuList Parameter Description
| Parameter Name | Required | Type | Length Limit | Example | Description |
| categoryNo | Yes | string | - | Category no | Category no |
| categoryName | No | string | - | Category name | Category name |
| productNo | Yes | string | - | Dish no | Dish no |
| productName | No | string | - | Dish name | Dish name |
| variant | Yes | int | - | 1 | Whether multiple specifications 1. Yes 2. No |
| skuNo | No | string | - | no | SKU code |
| skuName | Yes | string | - | name | SKU name |
| count | Yes | integer | - | 1 | User purchase quantity |
| price | Yes | integer | - | 100 | Dish amount (Unit: cent) |
| optionAmount | Yes | integer | - | 10 | Option additional amount |
| optionList | No | list | - | - | Option collection |
optionList Parameter Description
| Parameter Name | Required | Type | Length Limit | Example | Description |
| optionNo | No | string | - | no | option no |
| optionName | No | string | - | mingcheng | option name |
| optionItemList | No | list | - | - | option item details |
optionItemList Parameter Description
| Parameter Name | Required | Type | Length Limit | Example | Description |
| optionItemNo | No | string | - | no | option item no |
| optionItemName | No | list | - | item name | option item name |
| price | No | integer | - | 100 | Price (Unit: cent) |
Request Body Example
Response Example
Response Parameters
| Parameter Name | Type | Example | Description |
| code | int | 10000 | Status code Refer to list |
| message | string | success | Status code information |
| data | Boolean | - | Whether push was successful |
Successful Response Example
Failed Response Example
Retry Mechanism
| Retry Count | Interval | Description |
| 1st | Immediate | First callback |
| 2nd | 1 minute later | After 1st failure |
| 3rd | 5 minutes later | After 2nd failure |
| 4th | 30 minutes later | After 3rd failure |
If all 4 retries fail, the system will stop retrying, and merchants can actively obtain order status through the query
interface.
Notes
- Idempotency: The merchant interface needs to ensure idempotency to avoid duplicate processing of callbacks for
the same order
- Response Time: The merchant interface needs to return a response within 5 seconds, otherwise it will be
considered a failure
- Network Environment: Please ensure that the merchant callback interface can be accessed from the external network
- HTTPS: It is recommended to use HTTPS protocol to ensure data transmission security
- Log Recording: It is recommended that merchants record logs of all callback requests to facilitate
troubleshooting