Dynamic Virtual accounts

Creates a dynamic subwallet collection and generates a virtual bank account for the customer to make payment.

If the payment is successful, LedgerBlock sends a notification to the configured notification_url.

Method: POST

Endpoint:

{{base_url}}/api/v1/collection/subwallet

Authentication

Bearer Token

Include the Bearer token in the Authorization header.

Headers

HeaderValue
AuthorizationBearer <token>
x-merchant-ref<merchant-ref>
Content-Typeapplication/json

Request Body

{
  "user_ref": "USER-REF-001",
  "txn_merchant_ref": "TXN-REF-001",
  "amount": 100,
  "currency": "NGN",
  "chain": "",
  "payment_method": "DYNAMIC_VIRTUAL_ACCOUNT",
  "pay_meta_data": {},
  "notification_url": "https://example.com/webhook"
}

Request Fields

FieldRequiredDescription
user_refYesReference of the user making the payment
txn_merchant_refYesUnique merchant reference for the transaction
amountYesAmount to be collected
currencyYesCurrency of the collection
chainNoBlockchain/network. Leave empty for NGN virtual account collection
payment_methodYesPayment method. Use DYNAMIC_VIRTUAL_ACCOUNT
pay_meta_dataNoAdditional payment metadata
notification_urlYesURL where LedgerBlock sends payment status notifications

Response

{
  "status": "success",
  "message": "Please complete payment",
  "data": {
    "payment_ref": "PAYMENT-REF-001",
    "txn_merchant_ref": "TXN-REF-001",
    "amount": 100,
    "currency": "NGN",
    "pay_data": {
      "account_name": "Test Merchant",
      "account_number": "0123456789",
      "bank_code": "000001",
      "bank_name": "Test Bank",
      "expires": ""
    }
  }
}

Response Fields

FieldDescription
statusStatus of the request
messageMessage indicating that payment should be completed
data.payment_refLedgerBlock payment reference
data.txn_merchant_refMerchant reference for the transaction
data.amountAmount to be paid
data.currencyCurrency of the collection
data.pay_data.account_nameName associated with the virtual account
data.pay_data.account_numberDynamic virtual account number generated for the payment
data.pay_data.bank_codeBank code of the virtual account
data.pay_data.bank_nameBank name of the virtual account
data.pay_data.expiresExpiration time of the virtual account, if applicable

Collection Flow

Create Dynamic Virtual Account → Customer Makes Payment → Payment Successful → Notification Sent to notification_url

The generated virtual account details in pay_data should be provided to the customer to complete the payment. Once payment is successfully received, LedgerBlock sends the transaction notification to the configured notification_url.


Did this page help you?