Overview
In this tutorial, you’ll learn how to model online card payments using Blnk. We cover the full flow a card issuer needs to handle: creating an authorization hold, tracking the pending transaction, settling it when the processor clears it, and voiding it when it’s cancelled. By the end, you’ll know the exact ledger steps needed to support basic card payments.How online card payments work
When a customer makes a purchase with a card, the following happens:- Authorization: When your customer tries to pay, the card network asks your system if the customer has enough balance. If yes, you reserve that amount and create an inflight transaction. The money is not taken yet, only held.
-
Settlement: A few hours or days later, the payment processor sends the final confirmation.
- If the transaction is approved, you deduct the money from the customer’s balance and commit the transaction in your ledger.
- If it is declined or reversed, you release the reserved amount by voiding the transaction.
Prerequisites
Before starting, ensure you have:- A running Blnk server instance (e.g. at
http://localhost:5001). - An API key for Blnk (replace
YOUR_API_KEYin the code examples). Required for authenticated requests. - The Blnk CLI installed or a connected Blnk Cloud workspace to view your ledger data.
1: Create card account
Each card account will be represented with a ledger. The card balance will be created under this ledger.1
Create a ledger
Create a ledger for the card account. This groups all of the balances for that customer in one place:
Save the
ledger_id from the response. You’ll need it to create balances for the card account.
2
Create customer identity
Create a customer identity to link all balances to the same customer identity:
Save the
identity_id from the response. You’ll use this ID to link all balances to this customer.
3
Create card balance
Create a balance for the card account. This balance will track all card transactions:
Create balance

Save the
balance_id from the response. You’ll need it for creating transactions throughout this tutorial.2: Authorization
Authorizing a card transaction means telling the processor that the customer has enough funds to cover the transaction, and they can proceed with the transaction. You can model this in Blnk with inflight transactions.1
Money movement map
When a card transaction is authorized, money moves from the customer’s 
The transaction is created with
card_primary balance to @World-USD (representing the external merchant):
inflight: true, which means it’s pending until the payment processor clears it.2
Create an inflight transaction
Create an inflight transaction to authorize the payment. Setting Your transaction will be recorded successfully and it will be in 
inflight = true puts the transaction in a pending state until it’s settled or voided.@World-USD is an internal balance that represents money leaving and coming into your system (like payments to merchants or payments from customers). Internal balances use the @ prefix and don’t require a balance ID.INFLIGHT status (pending a commit or void action).
3
Handling fund reservation
When a transaction is inflight, the amount is reserved and cannot be used for anything else until it’s settled or voided.Blnk handles this automatically. Every inflight transaction reduces the customer’s available balance. If the available balance isn’t enough to cover a new transaction, the new one is rejected.For example:
- Customer balance: $5,000
- One inflight transaction: $2,000
- Available balance: $3,000

3: Settlement
Once a transaction is settled by the payment processor, it means the money has finally been transferred to the recipient. Now, you can commit the inflight transaction. This moves the transaction fromINFLIGHT (pending) to APPLIED (completed).
If it was rejected or cancelled, you can void the transaction instead.
1
Money movement map
When you commit the inflight transaction, it finalizes the money movement that was authorized:
The transaction status changes from

INFLIGHT to APPLIED, completing the transfer.2
Commit the inflight transaction
Commit the inflight transaction from the authorization step once clearing is received. This turns the transaction from
INFLIGHT (pending) to APPLIED (completed):3
Void a transaction
If a transaction is rejected or cancelled, you can void it instead of committing it:
Conclusion
You now have a fully functional card payment system built with Blnk Finance. This system can:- Create and manage card accounts with a ledger and card balance
- Authorize card transactions using inflight transactions to reserve funds
- Commit or void inflight transactions when they’re settled or rejected