post https://api.sandbox.midtrans.com/v2/charge
The steps to integrate with BCA Virtual Account are given below.
- Send the charge API request to Midtrans.
- Display the virtual account number.
- Handle notifications.
Send a Charge API request with the details of the transaction such as payment_type
, bank_transfer
, bca
, transaction_details
, item_details
, and customer_details
. Successful request returns a VA number.
By default, default expiry time for bank transfer is 24 hours unless specified by merchant (min 20s, max 180 days).
BCA Charge API Request
{
"payment_type": "bank_transfer",
"transaction_details": {
"gross_amount": 10000,
"order_id": "{{$timestamp}}"
},
"customer_details": {
"email": "[email protected]",
"first_name": "budi",
"last_name": "utomo",
"phone": "+6281 1234 1234"
},
"item_details": [
{
"id": "1388998298204",
"price": 5000,
"quantity": 1,
"name": "Ayam Zozozo"
},
{
"id": "1388998298205",
"price": 5000,
"quantity": 1,
"name": "Ayam Xoxoxo"
}
],
"bank_transfer":{
"bank": "bca",
"va_number": "111111",
"free_text": {
"inquiry": [
{
"id": "Free Text ID Free Text ID Free Text ID",
"en": "Free Text EN Free Text EN Free Text EN"
}
],
"payment": [
{
"id": "Free Text ID Free Text ID Free Text ID",
"en": "Free Text EN Free Text EN Free Text EN"
}
]
},
"bca": {
"sub_company_code": "00000"
}
}
}
JSON Attribute | Description | Type | Required |
---|---|---|---|
payment_type | Set Bank Transfer payment method. Value: bank_transfer | String | Required |
transaction_details | The details of the specific transaction such as order_id and gross_amount . | Object | Required |
customer_details | Details of the customer. | Object | Optional |
item_details | Details of the item(s) purchased by the customer. | Object | Optional |
bank_transfer | Charge details using bank transfer. | Object | Required |
BCA Virtual Account Sample Responses and Notifications
{
"status_code": "201",
"status_message": "Success, Bank Transfer transaction is created",
"transaction_id": "9aed5972-5b6a-401e-894b-a32c91ed1a3a",
"order_id": "1466323342",
"gross_amount": "20000.00",
"payment_type": "bank_transfer",
"transaction_time": "2016-06-19 15:02:22",
"transaction_status": "pending",
"va_numbers": [
{
"bank": "bca",
"va_number": "91019021579"
}
],
"fraud_status": "accept",
"currency": "IDR"
}
{
"va_numbers": [
{
"bank": "bca",
"va_number": "91019021579"
}
],
"transaction_time": "2016-06-19 15:02:22",
"gross_amount": "20000.00",
"order_id": "1466323342",
"payment_type": "bank_transfer",
"signature_key": "74d9b6f4cc36585d74e06c9dba360331e455171bcec35df60cf28a786436f8f96e6afcc1f091d6cb61411aec246ac28ba30b76d9b2c1cdb6409c0a70fcc1fe47",
"status_code": "201",
"transaction_id": "a9aed5972-5b6a-401e-894b-a32c91ed1a3a",
"transaction_status": "pending",
"fraud_status": "accept",
"status_message": "midtrans payment notification"
}
{
"va_numbers": [
{
"bank": "bca",
"va_number": "91019021579"
}
],
"transaction_time": "2016-06-19 19:12:22",
"gross_amount": "20000.00",
"order_id": "1466323342",
"payment_type": "bank_transfer",
"signature_key": "fe5f725ea770c451017e9d6300af72b830a668d2f7d5da9b778ec2c4f9177efe5127d492d9ddfbcf6806ea5cd7dc1a7337c674d6139026b28f49ad0ea1ce5107",
"status_code": "200",
"transaction_id": "9aed5972-5b6a-401e-894b-a32c91ed1a3a",
"transaction_status": "settlement",
"fraud_status": "accept",
"status_message": "midtrans payment notification"
}
{
"status_code": "202",
"status_message": "midtrans payment notification",
"transaction_id": "9aed5972-5b6a-401e-894b-a32c91ed1a3a",
"order_id": "1466323342",
"gross_amount": "20000.00",
"payment_type": "bank_transfer",
"transaction_time": "2016-06-20 15:02:23",
"transaction_status": "expire",
"signature_key": "e4e829a5d9a1e342daf181c5fd750afa64dd5a5c9a6e0cfb636e7966295b2613fda22b4dc52b01c30618a50ff3524f57ec661a9dced249df93f163138a0df6b0"
}
JSON Attribute | Description | Type |
---|---|---|
status_code | Status code of transaction charge result. | String |
status_message | Description of transaction charge result. | String |
transaction_id | Transaction ID given by Midtrans. | String |
order_id | Order ID specified by you. | String |
gross_amount | Total amount of transaction in IDR. | String |
payment_type | Transaction payment method. | String |
transaction_time | Timestamp of transaction in ISO 8601 format. Time Zone: GMT+7. | String |
transaction_status | Status of bank transfer transaction. Value:pending : Bank Transfer transaction is created. | String |
fraud_status | Detection result by Fraud Detection System (FDS). Value:accept : Approved by FDS. | String |
va_numbers | Bank name and Virtual Account number generated by Midtrans. | JSON Array |
currency | ISO-4217 representation of three-letter alphabetic currency code. Value: IDR .Note: Currently, only IDR is supported. | String |
signature_key | Combination of parameters such as order_id , status_code , gross_amount , server_key to verify integrity of payload/response. | String |
Note
Possible error codes are 400, 401, 402, 406, 410