Wallet and Transaction Flow
This guide details the complete wallet management and transaction processing flows in the FinHub platform v2.1. The new APIs provide a streamlined three-step process for executing transfers: checking allowed operations, preparing orders, and executing them. The flow includes enhanced security through payment consents and beneficiary management.Flow Overview
The following sequence diagram illustrates the enhanced wallet and transaction processes with v2.1 APIs:Prerequisites
Before processing transactions, ensure:- Customer is activated - Account activation automatically creates wallet and IBAN
- Customer is authenticated - Valid customer token required for all operations
- Session is established - X-Session-Id header required for transaction operations
- Beneficiaries are added - At least one beneficiary for transfers
- Payment consent is created (optional but recommended) - For enhanced security
Detailed API Flow
Step 1: Get Wallet Details
After customer activation, retrieve the wallet information including the IBAN and current balance. API Request:- Available: Funds available for immediate use
- Current: Total balance including pending transactions
- Locked: Funds reserved for pending operations
Step 2: Add Beneficiaries
Before making transfers, add beneficiaries to the wallet. API Request:Step 3: Create Payment Consent (Recommended)
For enhanced security, create a payment consent that defines transfer limits and beneficiary restrictions. API Request:Three-Step Transfer Process
The v2.1 API introduces a secure three-step process for executing transfers:Step 4: Get Allowed Operations
First, check what operations are available for the wallet based on current balance, limits, and consents. API Request:Step 5: Prepare Order
Prepare the transfer order to validate and calculate fees. API Request:Step 6: Execute Order
Complete the transfer by executing the prepared order. API Request:Step 7: Get Transaction History
View completed transactions and their details. API Request:Key Features of v2.1 Transaction Flow
Three-Step Process Benefits
- Pre-validation: Check allowed operations before attempting transfers
- Transparent Fees: Calculate exact fees before execution
- Consent Enforcement: Automatic validation of payment consents
- Balance Protection: Three-balance model prevents overdrafts
- Beneficiary Security: Restrict transfers to approved beneficiaries
Supported Transaction Types
- SEPA Transfers: Standard European payments
- SEPA Instant: Real-time European transfers
- International Transfers: SWIFT and other networks (if enabled)
- Internal Transfers: Between customer’s own accounts
- Top-ups: Adding funds to the wallet
Error Handling
The v2.1 API provides detailed error responses:Error Code | HTTP Status | Description |
---|---|---|
INSUFFICIENT_BALANCE | 409 | Wallet balance insufficient for the transaction |
LIMIT_EXCEEDED | 422 | Transaction exceeds defined limits |
INVALID_BENEFICIARY | 403 | Beneficiary not in allowed list |
CONSENT_EXPIRED | 422 | Payment consent has expired |
CONSENT_LIMIT_EXCEEDED | 422 | Transaction exceeds consent limits |
ORDER_EXPIRED | 410 | Prepared order has expired |
INVALID_IBAN | 400 | Provided IBAN is invalid |
DUPLICATE_EXECUTION | 409 | Order already executed |
WALLET_INACTIVE | 403 | Wallet is not active |
SESSION_REQUIRED | 401 | Valid session ID required |
Error Response Example
Security Best Practices
- Session Management: Always include X-Session-Id for transaction operations
- Token Security: Use customer tokens only for customer-initiated operations
- Consent Validation: Create payment consents with appropriate limits
- Beneficiary Verification: Validate beneficiaries before adding to allowed lists
- 2FA Implementation: Enable two-factor authentication for high-value transfers
- Audit Trail: Log all transaction attempts and outcomes
Implementation Checklist
- Implement wallet balance monitoring
- Set up beneficiary management workflow
- Create payment consents with appropriate limits
- Implement three-step transfer process
- Handle all error scenarios gracefully
- Add transaction history pagination
- Implement webhook handlers for real-time updates
- Set up monitoring and alerting
Performance Optimization
- Cache Beneficiaries: Store frequently used beneficiaries locally
- Batch Operations: Group multiple operations when possible
- Async Processing: Use webhooks for transaction status updates
- Connection Pooling: Maintain persistent API connections
- Rate Limiting: Implement client-side rate limiting
Next Steps
After implementing the wallet and transaction flows:- Implement webhook handlers
- Set up transaction monitoring
- Configure fraud detection
- Enable recurring payments
- Add multi-currency support