BNI Virtual Account

The steps to integrate with BNI Virtual Account are given below.

  1. Send the charge API request to Midtrans.
  2. Display the virtual account number.
  3. Handle notifications.

Send a Charge API request with the details of the transaction such as payment_type, bank_transfer, 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).




BNI 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": "bni",
     "va_number": "111111"
  }
}
JSON AttributeDescriptionTypeRequired
payment_typeSet Bank Transfer payment method. Value: bank_transferStringRequired
transaction_detailsThe details of the specific transaction such as order_id and gross_amount.ObjectRequired
customer_detailsDetails of the customer.ObjectOptional
item_detailsDetails of the item(s) purchased by the customer.ObjectOptional
bank_transferCharge details using bank transfer.ObjectRequired



BNI 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": "bni",
      "va_number": "8578000000111111"
    }
  ],
  "fraud_status": "accept",
  "currency": "IDR"
}
{
  "va_numbers": [
    {
      "bank": "bni",
      "va_number": "8578000000111111"
    }
  ],
  "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": "bni",
      "va_number": "8578000000111111"
    }
  ],
  "payment_amounts": [
    {
      "paid_at": "2016-06-19 20:12:22",
      "amount": "20000.00"
    }
  ],
  "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 AttributeDescriptionType
status_codeStatus code of transaction charge result.String
status_messageDescription of transaction charge result.String
transaction_idTransaction ID given by Midtrans.String
order_idOrder ID specified by you.String
gross_amountTotal amount of transaction in IDR.String
payment_typeTransaction payment method.String
transaction_timeTimestamp of transaction in ISO 8601 format. Time Zone: GMT+7.String
transaction_statusStatus of bank transfer transaction. Value:
pending : Bank Transfer transaction is created.
String
fraud_statusDetection result by Fraud Detection System (FDS). Value:
accept : Approved by FDS.
String
va_numbersBank name and Virtual Account number generated by Midtrans.JSON Array
payment_amountsPayment histories for the transaction. RECOMMEND TO NOT USE payment_amounts legacy field as payment_amounts is only filled in BNI-VA and is set as empty array [] in other banks (BCA, BRI, Permata)

RECOMMEND TO USE gross_amount field field instead since gross_amount field will always be there for all banks VA (BNI, BCA, BRI, Permata).
JSON Array
currencyISO-4217 representation of three-letter alphabetic currency code. Value: IDR.
Note: Currently only IDR is supported.
String
signature_keyCombination 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