Skip to main content

Payment Webhook

Process​

Description:

  • After receiving the payment result from the Partner Bank, Baokim will send a webhook to the merchant.
  • If the merchant processes successfully, respond with code = 0.
  • If the response code is non-zero, Baokim will resend the webhook 10 times, each time 5 minutes apart.

API Information​

Method: POST

URL: (URL configured by merchant with Baokim)

Request Header:

HeaderDescription
SignatureDigital signature to verify data integrity

Request​

(Baokim sends to merchant)

Main Parameters​

NoParameterData TypeRequiredDescription
1request_idString✅Request ID
2request_timeDatetime✅Request time. Format: YYYY-MM-DD H:m:s
3master_merchant_codeString(50)✅Master merchant code
4sub_merchant_codeString(50)✅Sub merchant code
5operationString✅Webhook type: PAYMENT_TRANS or REFUND_TRANS
6payment_resultObject✅Payment result
7token_resultObject❌Token information (NULL if not token payment)

Payment Result Information (payment_result)​

NoParameterData TypeRequiredDescription
1result_codeInteger✅Payment status
2result_messageString✅Result message
3orderObject✅Order information
4transactionsArray of Object✅Transaction list

Order Information (payment_result.order)​

NoParameterData TypeRequiredDescription
1idInteger✅Baokim order ID
2mrc_order_idString✅Merchant order ID (NULL if payment from static VA)
3total_amountInteger✅Order amount
4payment_methodInteger✅Payment method: 1 = VA, 2 = BNPL, 3 = Credit Card, 4 = Card Installment, 5 = ATM, 6 = VNPayQR, 22 = Auto debit
5statusInteger✅Status: 1 = Success, 6 = Pending prepayment, 9 = Refunded, 13 = Failed
6customer_infoObject❌Customer information
7completed_atDatetime✅Success time
8created_atDatetime✅Creation time
9updated_atDatetime✅Last update time

Customer Information (payment_result.order.customer_info)​

NoParameterData TypeRequiredDescription
1codeString❌Customer code
2nameString❌Customer name
3emailString❌Customer email
4phoneString❌Customer phone number
5addressString❌Customer address
6genderInteger❌Gender: 1 = Male, 2 = Female
7typeInteger❌Customer type: 1 = Individual, 2 = Business

Transaction Information (payment_result.transactions)​

NoParameterData TypeRequiredDescription
1idInteger✅Baokim transaction ID
2typeInteger✅Transaction type: 1 = Payment, 2 = Refund
3payment_methodInteger✅Payment method: 1 = VA, 2 = BNPL, 3 = Credit Card, 4 = Card Installment, 5 = ATM, 6 = VNPayQR, 22 = Auto debit
4sub_merchant_feeInteger✅Sub merchant fee
5master_merchant_feeInteger✅Master merchant fee
6master_merchant_modelInteger✅Master merchant model
7user_feeInteger✅User fee
8total_amountInteger✅Total customer payment after fees
9amountInteger✅Amount changing sub merchant balance
10descriptionString❌Transaction content
11statusInteger✅Status: 0 = Created, 1 = Success, 2 = Failed, 3 = Pending
12bnplObject❌BNPL information (if transaction is BNPL)
13installmentObject❌Installment information (if transaction is installment)
14completed_atDatetime✅Success time
15created_atDatetime✅Order creation time
16updated_atDatetime✅Last update time

BNPL Information (payment_result.transactions.bnpl)​

NoParameterData TypeRequiredDescription
1payment_per_monthInteger❌Amount to be paid each month (VND)
2paylater_amountInteger❌Amount paid later (VND)
3down_paymentInteger❌Down payment amount (VND)
4providerString❌Provider code

Installment Information (payment_result.transactions.installment)​

NoParameterData TypeRequiredDescription
1card_brandString❌Card brand used (Visa, MasterCard, JCB)
2periodInteger❌Installment term (number of months)
3payment_per_periodInteger❌Amount to be paid per period (VND)
4bank_codeString(6)❌Card-issuing bank code

Token Information (token_result)​

No.ParameterData TypeRequiredDescription
1result_codeInteger❌Token creation status
2result_messageString❌Message
3source_typeString❌Source type: ACCOUNT or CARD
4token_infoObject❌Token information

Token Information (token_info)​

No.ParameterData TypeRequiredDescription
1tokenString❌Token string saved on Baokim
2expired_atDatetime❌Token expiration time
3statusInteger❌Token status: 1 = Active, 0 = Deactive
4bank_nameString❌Full bank name
5holder_nameString❌Card/account holder name
6issue_dateString❌Card/account expiration date
7numberString❌Masked card number or account number
8bank_short_nameString❌Bank short name

Request Example​

{
"request_id": "1e3fe73d3054904a9a4bb",
"request_time": "2025-10-02 08:13:30",
"master_merchant_code": "BAOKIMMASTERMERCHANT",
"operation": "PAYMENT_TRANS",
"sub_merchant_code": "BAOKIMSUBMERCHANT",
"payment_result": {
"result_code": 200,
"result_message": "Payment successful",
"order": {
"id": 4412312,
"mrc_order_id": "BK_021_ANC",
"total_amount": 0,
"payment_method": 22,
"status": 1,
"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,
"type": 1
},
"completed_at": "2025-10-02 08:13:30",
"created_at": "2025-10-02 08:13:30",
"updated_at": "2025-10-02 08:13:30"
},
"transactions": [
{
"id": 1163423,
"type": 1,
"payment_method": 22,
"sub_merchant_fee": 3300,
"master_merchant_fee": 1100,
"master_merchant_model": 1,
"user_fee": 0,
"total_amount": 0,
"amount": -3300,
"description": "Payment for order",
"status": 1,
"bnpl": {
"payment_per_month": null,
"paylater_amount": null,
"down_payment": null,
"provider": null
},
"installment": {
"card_brand": null,
"period": null,
"payment_per_period": null,
"bank_code": null
},
"completed_at": "2025-10-02 08:13:30",
"created_at": "2025-10-02 08:13:30",
"updated_at": "2025-10-02 08:13:30"
}
]
},
"token_result": {
"result_code": 200,
"result_message": "Token create successful",
"source_type": "ACCOUNT",
"token_info": {
"token": "Mq7AwLoHkafPdXYxvYedH8sb6MZ18k",
"expired_at": "2050-10-13 21:16:30",
"status": 1,
"bank_name": "Ngân hàng TMCP Ngoại thương Việt Nam",
"holder_name": "NGUYEN VAN A",
"issue_date": "03/07",
"number": "970407xxxxxx1234",
"bank_short_name": "VCB"
}
}
}

Response​

(Merchant responds to Baokim)

Main Parameters​

NoParameterData TypeRequiredDescription
1codeInteger✅Result code. 0 = Merchant processed webhook successfully
2messageString✅Processing result message
3dataObject❌Returned data (if any)

Response Example​

{
"code": 200,
"message": "Successfully",
"data": null
}