Skip to main content

Create Order

Flow

Description:

  • Merchant calls this API to create an order on Baokim and receive payment link.
  • If response.code = 100: Baokim processes the transaction and returns result via Payment Webhook.
  • If response.code = 101: Merchant must redirect customer browser to redirect_url, after successful payment Baokim returns result via Payment Webhook.

Note on Auto Debit payment method (payment_method = 22):

  • Registration without payment: pass total_amount = 0.
  • Registration with payment: pass total_amount > 0.
  • Require auto debit payment: must pass payment_info.token and total_amount > 0.
  • Description content used as transfer content, maximum 120 characters.

API Information

Method: POST

URL: /b2b/core/api/ext/mm/order/send

Request

Main Parameters Table

No.ParameterData TypeRequiredDescription
1request_idString(50)Request ID
2request_timeDatetimeRequest time. Format: YYYY-MM-DD H:m:s
3master_merchant_codeString(50)Master merchant code provided by Baokim
4sub_merchant_codeString(50)Sub merchant code provided by Baokim
5store_codeString(50)Store code
6branch_codeString(50)Branch code
7staff_codeString(50)Sales staff code
8service_codeString(50)Service code (required if Auto Debit)
9mrc_order_idString(50)Merchant's order ID
10descriptionString(255)Order description
11total_amountIntegerTotal order amount (= 0 if registration only)
12url_successStringRedirect URL when payment succeeds
13url_failStringRedirect URL when payment fails
14save_tokenIntegerSave card information: 0 = No (default), 1 = Yes
15itemsArray of objectsProduct list (see table below)
16customer_infoObjectCustomer information (see table below)
17payment_infoObjectPayment information (see table below)
18payment_methodIntegerPayment method — required for Pro integration (see table below)

Payment Method Information (payment_method)

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

Payment Information (payment_info)

No.ParameterData TypeRequiredDescription
1tokenStringPayment token (required if card_hash null)
2card_hashStringEncrypted card information (required if token null)

Product Information (items)

No.ParameterData TypeRequiredDescription
1codeStringProduct code
2nameStringProduct name
3amountIntegerProduct price
4quantityIntegerQuantity
5linkStringProduct link

Customer Information (customer_info)

No.ParameterData TypeRequiredDescription
1codeStringCustomer code
2nameStringCustomer name
3emailStringEmail
4phoneStringPhone number
5addressStringAddress
6genderIntegerGender: 1 = Male, 2 = Female

Request Example

{
"request_id": "RQID0001",
"request_time": "2023-08-18 10:00:00",
"master_merchant_code": "BAOKIMMASTERMERCHANT",
"sub_merchant_code": "BAOKIMSUBMERCHANT",
"store_code": null,
"branch_code": null,
"staff_code": null,
"service_code": "BILLINTERNET",
"mrc_order_id": "BK_3894757",
"description": "Test Order",
"total_amount": 20000,
"url_success": "https://baokim.vn/success",
"url_fail": "https://baokim.vn/fail",
"save_token": 0,
"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_info": {
"token": "Mq7AwLoHkafPdXYxvYedH8sb6MZ18k",
"card_hash": null
},
"payment_method": 22
}

Response

Main Parameters Table

No.ParameterData TypeRequiredDescription
1codeIntegerResult code: 100 = Processing, 101 = Redirect required
2messageStringMessage
3dataObjectReturned data

Data Information

No.ParameterData TypeRequiredDescription
1order_idIntegerBaokim order ID
2mrc_order_idStringMerchant's order ID
3master_merchant_codeStringMaster merchant code
4sub_merchant_codeStringSub merchant code
5total_amountIntegerTotal order amount
6payment_methodIntegerPayment method
7created_atDatetimeCreation time
8updated_atDatetimeLast update time
9redirect_urlStringBaokim payment link (has value when code = 101)

Response Example — Redirect Required (code = 101)

{
"code": 101,
"message": "Success",
"data": {
"order_id": 50911,
"mrc_order_id": "BK_3894757",
"master_merchant_code": "BAOKIMMASTERMERCHANT",
"sub_merchant_code": "BAOKIMSUBMERCHANT",
"total_amount": 20000,
"payment_method": 22,
"created_at": "2025-04-14 15:23:10",
"updated_at": "2025-04-14 15:23:10",
"redirect_url": "https://b2b-payment-page.devtest.baokim.vn/payment/?oid=50911&checksum=50f1c60363c29c19b1c18359f1b4cfc655165117"
}
}

Response Example — Processing (code = 100)

{
"code": 100,
"message": "Transaction is being processed",
"data": {
"order_id": 50911,
"mrc_order_id": "BK_3894757",
"master_merchant_code": "BAOKIMMASTERMERCHANT",
"sub_merchant_code": "BAOKIMSUBMERCHANT",
"total_amount": 20000,
"payment_method": 22,
"created_at": "2025-04-14 15:23:10",
"updated_at": "2025-04-14 15:23:10",
"redirect_url": null
}
}

Error Codes

Error CodeDescription
100Processing
101Success - customer redirect required
102Provider error
104Authentication error
707Order ID already exists
709Master Merchant cannot create transaction on its own
710Sub Merchant not found
711Master Merchant not found
712Sub Merchant inactive
713Master Merchant inactive
714Sub Merchant does not belong to Master Merchant
717Service code not found
718Service code inactive
720Invalid token
724Fee configuration not found