# 1. Create order(general)
# Brief Description
- After Merchant confirms the completion of the payment, needs to send a request to Swifood to create an order. Swifood will then create the order for the merchant and push the instruction to print the payment receipt to the connected printer.
# HTTP Request Information
# Request URL
{domain}/open-api/order/create
# Request Method
- POST
# Request Header
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Content-Type | Yes | string | application/json |
# Request Body Parameters
| Parameter Name | Required | Type | Length Limit | Example | Description |
|---|---|---|---|---|---|
| appId | Yes | string | - | 45eebd745dcf0b5f6d6f9fcde28cd9fe8116a892 | App id (provided by Swifood) |
| storeKey | Yes | string | 100 | CVIEIYUNHTS0 | Store key (provided by Swifood) |
| param | Yes | string | - | - | Request param content string |
| sign | Yes | string | - | RSA sign of param |
# Param Parameters
| Parameter Name | Required | Type | Length Limit | Example | Description |
|---|---|---|---|---|---|
| productInfo | Yes | List | 1 - 50 | - | Product info |
| serviceFee | No | integer | 0 - 10000000 | 10 | Service fee, Unit: cents(table code required) |
| orderType | Yes | integer | - | 2 | Order type 1:table code order 2:queue order 3:takeout order |
| paymentWay | Yes | string | - | 1 | Payment method 1: Online 2: Offline |
| pickUpNum | No | string | 1 - 50 | 001 | Pick-up code (Fill in queue order, Swifood automatically generates when empty) |
| merchantDeliveryFee | No | integer | 0 - 10000000 | 10 | Merchant Delivery fee, Unit: cents (The merchant bears the delivery fee) |
| deliveryFee | No | integer | 0 - 10000000 | 10 | User Delivery fee, Unit: cents (required for takeout order,The user bears the delivery fee) |
| packingFee | No | integer | 0 - 10000000 | 10 | Packing fee, Unit: cents (required for takeout order) |
| userName | No | string | 1 - 100 | Join | User name for delivery order |
| userPhone | No | string | 1 - 20 | - | Mobile phone number of takeout order user |
| userAddress | No | string | 1 - 200 | - | Address of the delivery order user |
| customPrintContext | No | string | - | Test | Merchants customize the printing content |
| paymentChannel | No | string | 1 - 200 | QRPH_DYNAMIC_QR | Payment channel (required for online trading) |
| paymentTransactionId | Yes | string | 1 - 50 | Payment Transaction id (merchant order number,Online payment requires the MchOrderId of the platform) | |
| paymentAmount | No | integer | 0 - 100000000 | 100 | Amount paid (real payment amount), unit: cents |
| discountAmount | No | integer | 0 - 100000000 | 10 | Discount amount, unit: cents |
| discountType | No | string | - | Discount type 1: Promo discount; 2: PWD discount; 4: SC discount | |
| promoDiscountType | No | integer | - | 1 | 1. Whole order discount 2. Product discount |
| discountNo | No | string | 1 - 200 | 120941 | Discount card number (PWD, SC discount required) |
| discounterName | No | string | 1 - 50 | Join | Name of customer (PWD, SC discount required) |
| discountValidityPeriod | No | string | 1 - 200 | 2025-01-01 | Offer validity (PWD discount required) |
| transactionFee | No | integer | 0 - 100000000 | 10 | Transaction fee unit: cents (fees generated by online transactions) |
| transactionFeeType | No | integer | 1 | Transaction fee type; 1:merchant; 2:user (Online transaction fee undertaker) | |
| transactionId | No | string | 1 - 50 | SR93458586001 | Payment Transaction id (Paycools system order number) |
| paymentPlatform | No | string | 1 - 200 | Paycools | Pyment Platform (Only Paycools are supported for now) |
| transactionCreateTime | No | string | 1 - 200 | 2025-01-01 00:00:00 | Transaction creation time (required for online trading) |
| transactionReturnTime | No | string | 1 - 200 | 2025-01-01 00:00:00 | Transaction closing time (required for online trading) |
# Product Info Param
| Parameter Name | Required | Type | Length Limit | Example | Description |
|---|---|---|---|---|---|
| productName | Yes | string | 1 - 50 | coffee | Product name |
| price | Yes | integer | 0 - 1000000 | 100 | Unit price of product after tax, Unit: cents |
| quantity | Yes | integer | 1 - 1000 | 1 | Product quantity |
# Request body example
{
"appId": "OpenTestAppId",
"storeKey": "OpenTestStoreKey",
"sign": "OpenTestSign",
"param": "{\"productInfo\":[{\"productName\":\"item1\",\"price\":100,\"quantity\": 1},{\"productName\":\"item2\",\"price\":100,\"quantity\":1}],\"customPrintContext\":\"test custom\",\"paymentWay\": 1,\"paymentTransaction\": \"ON12384876123\",\"paymentAmount\": 190,\"discountAmount\":10,\"transactionFeeType\":\"1\",\"orderType\":2,\"discountType\":1,\"paymentChannel\":\"QRPH_DYNAMIC_QR\",\"transactionId\":\"OpenTest003\",\"paymentTransactionId\":\"OpenTestMch003\",\"transactionFee\":1,\"transactionCreateTime\":\"2024-12-12 00:00:00\",\"transactionReturnTime\":\"2024-12-12 00:00:00\",\"discounterName\":\"open\",\"discountNo\":\"openDiscount001\",\"discountValidityPeriod\":\"2024-12-30\"}"
}
# Response Example
# Code Refer to this list
# Response Parameters
| Parameter Name | Type | Example | Description |
|---|---|---|---|
| code | integer | 10000 | Status Code Refer to List |
| message | string | success | Status Code Information |
| data | Object | - | Response Param |
| - orderNo | string | - | Order number |
| - pickUpNo | string | - | Pick up code (Returned for queue orders) |
{
"code": 10000,
"message": "success",
"data": "{\"orderNo\":\"TB*******431\",\"pickUpNo\": \"001\", \"takeoutNo\":\"001\"}"
}
# Failed Response Example
{
"code":21000,
"message":"Service error, please contact administrator",
"data":null
}
# Payment Channel
| Channel Name | Channel Code |
|---|---|
| QRPH | QRPH_DYNAMIC_QR |
| GCash WebPay | GCASH_URL |
| Grab WebPay | GRPY_URL |
| UnionBank | UBPB_URL |
| BPI | BPIA_URL |
| Maya | PAYMAYA_URL |
| UnionBank | UBPB_URL |
| Alipay | ZFB_URL |
| GCash QR | GCASH_DYNAMIC_QR |
| GCash Scan QR | GCASH_CPM |