Create Order
Flow
Description:
- Merchant calls this API to create an order on Baokim and receive payment link.
API Information
Method: POST
URL: /b2b/core/api/ext/order/send
Request
Main Parameters Table
| Field Name | Data Type | Required | Description |
|---|---|---|---|
| request_id | String(50) | ✅ | Request ID |
| request_time | Datetime | ✅ | Request time. Format: YYYY-MM-DD H:m:s |
| merchant_code | String(50) | ✅ | Merchant code provided by Baokim |
| store_code | String(50) | ❌ | Store code |
| branch_code | String(50) | ❌ | Branch code |
| staff_code | String(50) | ❌ | Sales staff code |
| mrc_order_id | String(50) | ✅ | Merchant's order ID |
| description | String(255) | ✅ | Order description |
| total_amount | Integer | ✅ | Total order amount |
| url_success | String | ✅ | Redirect URL when payment succeeds |
| url_fail | String | ✅ | Redirect URL when payment fails |
| items | Array of objects | ❌ | Product list (See table below) |
| customer_info | Object | ❌ | Customer information (See table below) |
| payment_method | Integer | ❌ | Payment method — required for Pro integration (See table below) |
Payment Methods (payment_method)
| Value | Method |
|---|---|
| 1 | VA |
| 2 | BNPL |
| 3 | Credit Card |
| 4 | Card Installment |
| 5 | ATM |
| 6 | VNPayQR |
Product Information (items)
caution
items is an array of arrays — each outer element is a product group, with inner elements being product objects.
| Field Name | Data Type | Required | Description |
|---|---|---|---|
| code | String | ✅ | Product code |
| name | String | ✅ | Product name |
| amount | Integer | ✅ | Product price |
| quantity | Integer | ✅ | Quantity |
| link | String | ✅ | Product link |
Customer Information (customer_info)
| Field Name | Data Type | Required | Description |
|---|---|---|---|
| code | String | ✅ | Customer code |
| name | String | ✅ | Customer name |
| String | ✅ | ||
| phone | String | ✅ | Phone number |
| address | String | ✅ | Address |
| gender | Integer | ✅ | Gender: 1 = Male, 2 = Female |
Request Example
{
"request_id": "RQID0001",
"request_time": "2023-08-18T10:00:00.000Z",
"merchant_code": "BAOKIMMERCHANT",
"store_code": null,
"branch_code": null,
"staff_code": null,
"mrc_order_id": "BK_3894757",
"description": "Test Order",
"total_amount": 20000,
"url_success": "https://baokim.vn/",
"url_fail": "https://baokim.vn/",
"items": [
[
{
"code": "SP001",
"name": "Product 01",
"amount": 10000,
"quantity": 1,
"link": "https://baokim.vn/items/1"
},
{
"code": "SP002",
"name": "Product 02",
"amount": 10000,
"quantity": 1,
"link": "https://baokim.vn/items/2"
}
]
],
"customer_info": {
"code": "KH001",
"name": "Nguyen Van A",
"email": "[email protected]",
"phone": "0812345678",
"address": "313 Truong Chinh, Khuong Mai, Thanh Xuan, Ha Noi",
"gender": 1
},
"payment_method": null
}
Response
note
HTTP 200 - Success
Main Parameters Table
| Field Name | Data Type | Required | Description |
|---|---|---|---|
| code | Integer | ✅ | Result code |
| message | String | ✅ | Message |
| data | Object | ✅ | Returned data |
Data Information
| Field Name | Data Type | Required | Description |
|---|---|---|---|
| order_id | Integer | ✅ | Order ID on Baokim system |
| mrc_order_id | String | ✅ | Merchant's order ID |
| payment_url | String | ✅ | Link to Baokim payment page |
Response Example
{
"code": 0,
"message": null,
"data": {
"order_id": 50911,
"mrc_order_id": "BK_3894757",
"payment_url": "https://b2b-payment-page.devtest.baokim.vn/payment/?oid=50911&checksum=50f1c60363c29c19b1c18359f1b4cfc655165117"
}
}
Error Codes
| Error Code | Description |
|---|---|
| 102 | Provider error |
| 104 | Authentication error |
| 105 | Invalid digital signature |
| 110 | Merchant order ID already exists |