Skip to main content

Authentication

Process

  • Merchant sends a request to Baokim

API Information

Method: POST

URL:

Merchant sends card information → Baokim returns 3DS link to redirect user to authenticate OTP.

Request

Main Parameters

NoField NameData TypeRequiredDescription
1request_idString(100)Unique request ID
2request_timeString(20)Request send time. Format: YYYY-MM-DD H:i:s
3master_merchant_codeString(50)Unique identifier for master merchant
4sub_merchant_codeString(50)Unique identifier for sub merchant
5amountNumberOrder amount (will not be deducted after successful authentication)
6cardObjectCard information — see below
7url_successString(255)URL redirect on successful authentication
8url_failString(255)URL redirect on failed authentication
9save_tokenNumberSave token or not?: 0 = No (default) / 1 = Yes
10typeNumberPayment type: 1 = PaymentByCard (default), 2 = UCOF-CIT
11off_3dsNumberDisable 3DS authentication? 0 = No (default) / 1 = Disable 3DS
12extendObjectExtended data (billing)

Card Information

NoField NameData TypeRequiredDescription
1card_dataStringCard information encrypted per Baokim standard, required if card_token null. If type = 2 (UCOF-CIT), must provide card_data
2card_tokenString(255)Saved card token. Required if card_data null

Card_data Information Before Encryption

No.Field NameData TypeRequiredDescription
1card_numberString(20)Card number
2card_nameString(255)Cardholder name
3card_monthString(2)Card expiry month
4card_yearString(4)Card expiry year
5card_cvvString(3)Card security code

Extend Information

No.Field NameData TypeRequiredDescription
1billingObjectPayer information

Extend.billing Information

No.Field NameData TypeRequiredDescription
1firstnameString(255)Payer first name
2lastnameString(255)Payer last name
3addressString(500)Payer address
4cityString(50)City (Example: HANOI)
5stateString(255)State/Province
6countryString(2)Country ISO2 (Example: VN)
7emailString(255)Payer email
8phoneString(10)Phone number
9postal_codeString(6)Postal code

Example Request

{
"request_id": "MERCHANT050015588AXE00",
"request_time": "2020-08-11 14:41:00",
"master_merchant_code": "MASTER_MERCHANT",
"sub_merchant_code": "SUB_MERCHANT",
"amount": 20000,
"card": { "card_data": "yeAhZHfP6cWkLCL28svcXv2F9ntN3I1xBFGJG17JfxERkg8913ZxV", "card_token": null },
"url_success": "https://example.com/success",
"url_fail": "https://example.com/fail",
"save_token": 0,
"type": 1,
"off_3ds": 0,
"extend": {
"billing": {
"firstname": "A",
"lastname": "NGUYEN VAN",
"city": "HANOI",
"state": null,
"country": "VN",
"email": "[email protected]",
"phone": "0394899999"
"postal_code": "10000"
}
}
}

Response

Main Parameters Table

No.Field NameData TypeRequiredDescription
1codeNumber(3)Baokim error code
2messageString(200)Baokim error message
3dataObjectData returned by Baokim

Data Information

No.Field NameData TypeRequiredDescription
1order_idNumberBaokim order ID
2order_codeString(50)Baokim authentication transaction code
3authen_statusNumberCard authentication status: 0 = Pending / 1 = Authenticated / 2 = Failed / 3 = Bypass (3DS off) / 4 = Pending
43ds_urlString(255)3DS authentication link — redirect user here

Example Response

{
"code": 0,
"message": "Success",
"data": {
"order_id": 1870436,
"order_code": "VLAD_1753867524",
"authen_status": 0,
"3ds_url": "https://payment-page.baokim.vn/payment/?oid=38260&checksum=d863a2d66f76e3fc7bcfe302bfc19ff3e5253f5c"
}
}

Error Code Table

Error CodeDescription
100Success
11Failed
101Baokim system error
104OAuth authentication error
105Signature authentication error
422Validation error: RequestId invalid
422Validation error: RequestTime invalid
422Validation error: PartnerCode invalid
422Card_data invalid
422Amount invalid
301Order not found by order_code
302Card issue (does not exist, expired)
303Card declined
304Insufficient card balance
305User cancelled transaction
306Incorrect OTP
308Transaction has not completed Authentication
309Transaction has not completed Authorization
310Transaction already reversed — cannot capture
311Transaction already captured — cannot reverse
313Bank-side processing error