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.
PreAuthorization class allows you to hold funds on a customer’s card without immediately charging it. This is useful for scenarios like hotel reservations, car rentals, or any situation where you need to guarantee payment availability before providing services.
Overview
Pre-authorization follows a three-step flow:Special Configuration
Pre-authorization requires special API keys:The keys shown above are special pre-authorization keys. You must use these specific keys for pre-auth transactions, not your regular API keys.
Pre-authorization Parameters
Customer’s card number
Card CVV/CVC code
Card expiry month (e.g., “08”)
Card expiry year (e.g., “20”)
Amount to pre-authorize
Customer’s email address
Customer’s phone number
Customer’s first name
Customer’s last name
Your unique transaction reference
Must be set to “preauth”
URL to redirect after authorization
Currency code (defaults to NGN)
Country code (defaults to NG)
Customer’s IP address (auto-detected if not provided)
Device fingerprint for fraud detection
Pre-authorizing a Card
The
charge_type parameter must be set to "preauth" for pre-authorization transactions. The system will hold the specified amount on the card without actually charging it.Capturing Pre-authorized Funds
Once you’re ready to charge the customer (e.g., after service delivery), capture the pre-authorized amount:The payment gateway’s unique reference returned from
preAuthorizeCard()Refunding or Voiding
You can either refund a captured amount or void an uncaptured pre-authorization:Voiding a Pre-authorization
To release the hold without charging:Refunding a Captured Amount
To refund after capturing:Action to take: either “refund” or “void”
- Void
- Refund
When to use: Before capturing fundsEffect: Releases the hold on customer’s card without any chargeUse case: Customer cancels reservation before check-in
Complete Workflow Example
Use Cases
Hotel Reservations
Hold funds when customer books a room, capture on check-in, void if cancelled
Car Rentals
Pre-authorize for rental amount + deposit, capture actual charges after return
Event Tickets
Hold payment when tickets are reserved, capture closer to event date
Custom Orders
Hold funds during production, capture when item ships
Method Reference
| Method | Parameters | Returns | Description |
|---|---|---|---|
preAuthorizeCard() | Card details + charge_type: "preauth" | JSONObject | Holds funds on card without charging |
capture() | flwRef | JSONObject | Captures pre-authorized funds |
refundOrVoid() | flwRef, action | JSONObject | Refunds or voids pre-authorization |
Important Considerations
- Timing
- Amounts
- Security
- Pre-authorizations typically expire after 7-30 days (varies by card issuer)
- Capture funds before the pre-auth expires
- Check with card networks for specific time limits
- Don’t hold funds longer than necessary
Best Practices
- Communicate clearly with customers: Let them know funds are being held, not charged immediately
- Set expectations: Inform customers when the hold will be released if not captured
- Capture promptly: Don’t wait until the last minute before pre-auth expiration
- Handle expirations: Implement logic to detect and handle expired pre-authorizations
- Void unused pre-auths: Release holds as soon as you know they won’t be needed
- Monitor transactions: Track pre-auth status and follow up on pending captures
Troubleshooting
Pre-authorization Failed
- Verify you’re using the special pre-auth API keys
- Ensure
charge_typeis set to"preauth" - Check that pre-authorization is enabled for your account
- Verify card details are correct
Capture Failed
- Check if pre-authorization has expired
- Verify the
flwRefmatches the original pre-auth - Ensure the amount doesn’t exceed pre-authorized amount
- Confirm funds are still available on the card
Void/Refund Failed
- Verify the correct action (“void” vs “refund”) for the transaction state
- Check if transaction has already been captured (use refund, not void)
- Ensure the
flwRefis valid and matches the transaction
Next Steps
Card Payments
Learn about standard card payment processing
Transaction Verification
Verify and track transaction status