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_timeDatetimeRequest 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_amountIntegerTotal order amount
url_successStringRedirect URL when payment succeeds
url_failStringRedirect URL when payment fails
itemsArray of objectsProduct list (See table below)
customer_infoObjectCustomer information (See table below)
payment_methodIntegerPayment method — required for Pro integration (See table below)

Payment Methods (payment_method)

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

Product Information (items)

caution

items is an array of arrays — each outer element is a product group, with inner elements being product objects.

Field NameData TypeRequiredDescription
codeStringProduct code
nameStringProduct name
amountIntegerProduct price
quantityIntegerQuantity
linkStringProduct link

Customer Information (customer_info)

Field NameData TypeRequiredDescription
codeStringCustomer code
nameStringCustomer name
emailStringEmail
phoneStringPhone number
addressStringAddress
genderIntegerGender: 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
codeIntegerResult code
messageStringMessage
dataObjectReturned data

Data Information

Field NameData TypeRequiredDescription
order_idIntegerOrder ID on Baokim system
mrc_order_idStringMerchant's order ID
payment_urlStringLink 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