TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/theresasogunle/Fintech-flutterwave-Java-Library/llms.txt
Use this file to discover all available pages before exploring further.
AccountCharge class enables direct bank account payments in Nigeria. This payment method requires customers to provide their account details and validate the transaction with an OTP.
Overview
Account payments follow a two-step flow:- Charge: Initiate the payment with account details
- Validate: Complete the payment with OTP verification
Configuration
First, configure your Rave credentials:Account Charge Parameters
Customer’s bank account number
Bank short code (e.g., “044” for Access Bank)
Transaction amount
Customer’s email address
Your unique transaction reference
Customer’s first name
Customer’s last name
Customer’s IP address
Currency code (defaults to NGN)
Country code (defaults to NG)
Customer’s phone number (optional)
Account passcode (optional)
Device fingerprint for fraud detection (optional)
Charging a Bank Account
Initiate Charge
Call the The response will contain a
chargeAccount() method to initiate the payment:flwRef (transaction reference) that you’ll need for validation.Complete Example
Polling Support
Both the charge and validation methods support polling for handling timeout scenarios.Charge with Polling
If the initial charge request times out, use polling:Setting the polling parameter to
true enables automatic retry logic for timeout scenarios.Validation with Polling
Similarly, you can poll during validation:Bank Codes
Common Nigerian bank codes:| Bank Name | Bank Code |
|---|---|
| Access Bank | 044 |
| GTBank | 058 |
| Zenith Bank | 057 |
| First Bank | 011 |
| UBA | 033 |
| Fidelity Bank | 070 |
| FCMB | 214 |
| Stanbic IBTC | 221 |
| Sterling Bank | 232 |
| Union Bank | 032 |
Payment Type
The payment type is automatically set to"account" by the setJSON() method in the AccountCharge class. You don’t need to set this manually.
Response Handling
Charge Response
ThechargeAccount() method returns a JSON object with the following structure:
Validation Response
ThevalidateAccountCharge() method returns:
Method Reference
| Method | Parameters | Returns | Description |
|---|---|---|---|
chargeAccount() | - | JSONObject | Initiates account charge |
chargeAccount(boolean polling) | polling | JSONObject | Initiates charge with polling support |
validateAccountCharge() | - | JSONObject | Validates charge with OTP |
validateAccountCharge(boolean polling) | polling | JSONObject | Validates with polling support |
Best Practices
- Security
- User Experience
- Error Handling
- Never store sensitive account details
- Always use HTTPS for API calls
- Validate transaction amounts before processing
- Implement proper error handling
Troubleshooting
Common Issues
Invalid Bank Code- Ensure you’re using the correct 3-digit bank code
- Verify the bank code matches the account number
- Verify the customer’s email and phone number are correct
- Check if the bank account is active and valid
- Wait a few minutes and retry
- Ensure the OTP is entered correctly
- Check that the transaction reference matches
- Verify the OTP hasn’t expired
Next Steps
Card Payments
Accept credit and debit card payments
Alternative Payments
Support USSD, mobile money, and M-Pesa