Understanding Your Wallet Structure
Learn how NextAPI wallets are structured and how they organize funds across different accounts and purposes.
Wallet Hierarchy
NextAPI uses a hierarchical wallet structure to organize funds:
Master Wallet (Platform)
├── Operating Wallet
├── Reserve Wallet
└── Sub-Merchant Wallets
├── User Wallet 1
├── User Wallet 2
└── User Wallet N
Wallet Types
Master Wallet
- Holds all platform funds
- Managed by platform administrators
- Source of funds for sub-merchant wallets
Operating Wallet
- Day-to-day transaction funds
- Liquid and readily available
- Used for immediate payouts
Reserve Wallet
- Emergency and contingency funds
- Regulatory compliance requirements
- Not typically used for regular operations
Sub-Merchant Wallets
- Individual user or business wallets
- Isolated from other users' funds
- Independent balance tracking
Balance Structure
Each wallet maintains multiple balance states:
{
"wallet_id": "wallet_123",
"balances": {
"available": 100000, // Ready for withdrawal
"pending": 25000, // In transit/processing
"reserved": 15000, // Held for disputes/chargebacks
"total": 140000 // Sum of all balances
},
"currency": "PHP"
}
Fund Flow
Credit Operations
- Funds enter Master Wallet
- Credit to Operating or Reserve Wallet
- Distribute to Sub-Merchant Wallets
- Update available/pending balances
Debit Operations
- Request payout from Sub-Merchant Wallet
- Check available balance
- Reserve funds during processing
- Complete debit and update balances
Security Features
- Fund Isolation: Each sub-merchant wallet is cryptographically isolated
- Audit Trail: All balance changes are logged and auditable
- Multi-signature: Critical operations require multiple approvals
- Real-time Reconciliation: Balances are continuously reconciled
API Access
Different wallet operations require different permissions:
// View wallet balance
GET /v1/wallets/{wallet_id}/balance
// Credit wallet (funds in)
POST /v1/wallets/{wallet_id}/credit
// Debit wallet (funds out)
POST /v1/wallets/{wallet_id}/debit
// Transfer between wallets
POST /v1/wallets/{source_id}/transfer
Best Practices
- Monitor Balances: Regularly check wallet balances
- Set Alerts: Configure low-balance alerts
- Maintain Reserves: Keep adequate reserve funds
- Reconcile Daily: Perform daily balance reconciliation
- Track Pending: Monitor pending transaction amounts
Related Concepts
- [The Lifecycle of a Payout](./the-lifecycle-of-a-payout
- [Security & Compliance](./security-compliance
- [IDs, Reference IDs, and Idempotency](./ids-reference-ids-idempotency