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_idStringRequest ID
2request_timeDatetimeRequest time. Format: YYYY-MM-DD H:m:s
3master_merchant_codeString(50)Master merchant code
4sub_merchant_codeString(50)Sub merchant code
5operationStringWebhook type: PAYMENT_TRANS or REFUND_TRANS
6payment_resultObjectPayment result
7token_resultObjectToken information (NULL if not token payment)

Payment Result Information (payment_result)

NoParameterData TypeRequiredDescription
1result_codeIntegerPayment status
2result_messageStringResult message
3orderObjectOrder information
4transactionsArray of ObjectTransaction list

Order Information (payment_result.order)

NoParameterData TypeRequiredDescription
1idIntegerBaokim order ID
2mrc_order_idStringMerchant order ID (NULL if payment from static VA)
3total_amountIntegerOrder amount
4payment_methodIntegerPayment method: 1 = VA, 2 = BNPL, 3 = Credit Card, 4 = Card Installment, 5 = ATM, 6 = VNPayQR, 22 = Auto debit
5statusIntegerStatus: 1 = Success, 6 = Pending prepayment, 9 = Refunded, 13 = Failed
6customer_infoObjectCustomer information
7completed_atDatetimeSuccess time
8created_atDatetimeCreation time
9updated_atDatetimeLast update time

Transaction Information (payment_result.transactions)

NoParameterData TypeRequiredDescription
1idIntegerBaokim transaction ID
2typeIntegerTransaction type: 1 = Payment, 2 = Refund
3payment_methodIntegerPayment method: 1 = VA, 2 = BNPL, 3 = Credit Card, 4 = Card Installment, 5 = ATM, 6 = VNPayQR, 22 = Auto debit
4sub_merchant_feeIntegerSub merchant fee
5master_merchant_feeIntegerMaster merchant fee
6master_merchant_modelIntegerMaster merchant model
7user_feeIntegerUser fee
8total_amountIntegerTotal customer payment after fees
9amountIntegerAmount changing sub merchant balance
10descriptionStringTransaction content
11statusIntegerStatus: 0 = Created, 1 = Success, 2 = Failed, 3 = Pending
12bnplObjectBNPL information (if transaction is BNPL)
13installmentObjectInstallment information (if transaction is installment)
14completed_atDatetimeSuccess time
15created_atDatetimeOrder creation time
16updated_atDatetimeLast update time

Token Information (token_result)

No.ParameterData TypeRequiredDescription
1result_codeIntegerToken creation status
2result_messageStringMessage
3source_typeStringSource type: ACCOUNT or CARD
4token_infoObjectToken information

Token Information (token_info)

No.ParameterData TypeRequiredDescription
1tokenStringToken string saved on Baokim
2expired_atDatetimeToken expiration time
3statusIntegerToken status: 1 = Active, 0 = Deactive
4bank_nameStringFull bank name
5holder_nameStringCard/account holder name
6issue_dateStringCard/account expiration date
7numberStringMasked card number or account number
8bank_short_nameStringBank 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 returns to Baokim)

Main Parameters Table

No.ParameterData TypeRequiredDescription
1codeInteger0 = Success, non-zero = Baokim will resend webhook
2messageStringResponse content
3dataObjectAttached data (if any)

Success Response Example

{
"code": 0,
"message": "Success",
"data": {}
}