Create programmable wallets
Problem
Wallet balances must remain consistent while supporting credits, debits, and policy controls.
Architecture
Wallet ledger
Wallet
Ledger Entries
Balance Calculation
Spending Controls
Reconciliation
Implementation
Implementation
- 1Create a wallet for the customer or merchant.
- 2Record credits and debits as ledger entries.
- 3Compute balances from the ledger stream.
- 4Expose balances to checkout and payouts.
API example
Create wallet
const wallet = await orangepill.wallets.create({
owner_id: "cust_123",
currency: "COP"
})Production considerations
- Keep ledger entries immutable for auditability.
- Reconcile wallet balances with settlement data.
- Enforce spend limits and policy rules.
- Monitor ledger lag and consistency.