Skip to main content

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 NameData TypeRequiredDescription
request_idString(50)✅Request ID
request_timeDatetime✅Request time. Format: YYYY-MM-DD H:m:s
merchant_codeString(50)✅Merchant code provided by Baokim
store_codeString(50)❌Store code
branch_codeString(50)❌Branch code
staff_codeString(50)❌Sales staff code
mrc_order_idString(50)✅Merchant's order ID
descriptionString(255)✅Order description
total_amountInteger✅Total order amount
url_successString✅Redirect URL when payment succeeds
url_failString✅Redirect URL when payment fails
itemsArray of objects❌Product list (See table below)
customer_infoObject❌Customer information (See table below)
payment_methodInteger❌Payment method — required for Pro integration (See table below)

Payment Methods (payment_method)​

ValueMethod
1VA
2BNPL
3Credit Card
4Card Installment
5ATM
6VNPayQR

Product Information (items)​

items is an array of product objects.

Field NameData TypeRequiredDescription
codeString✅Product code
nameString✅Product name
amountInteger✅Product price
quantityInteger✅Quantity
linkString✅Product link

Customer Information (customer_info)​

Field NameData TypeRequiredDescription
codeString✅Customer code
nameString✅Customer name
emailString✅Email
phoneString✅Phone number
addressString✅Address
genderInteger✅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 NameData TypeRequiredDescription
codeInteger✅Result code
messageString✅Message
dataObject✅Returned data

Data Information​

Field NameData TypeRequiredDescription
order_idInteger✅Order ID on Baokim system
mrc_order_idString✅Merchant's order ID
payment_urlString✅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 CodeDescription
102Provider error
104Authentication error
105Invalid digital signature
110Merchant order ID already exists