Overview
TheTransaction class provides methods to verify transaction status using Flutterwave’s verification endpoints. It supports both standard verification and cross-verification (xrequery) to validate transaction outcomes.
Constructor
Setter Methods
The Transaction class uses method chaining for configuration. All setter methods return theTransaction instance.
setFlwref()
Sets the Flutterwave reference for the transaction.The Flutterwave reference (flw_ref) assigned to the transaction
Transaction - The current Transaction instance for method chaining
setTxRef()
Sets the transaction reference.The unique transaction reference (txref) provided by the merchant
Transaction - The current Transaction instance for method chaining
Getter Methods
getFlwref()
Retrieves the Flutterwave reference.String - The Flutterwave reference
getTxRef()
Retrieves the transaction reference.String - The transaction reference
Public Methods
verifyTransactionRequery()
Verifies a transaction using the standard requery endpoint. This method is useful for verifying failed transactions or checking the current status of a transaction.JSONObject - The verification response containing transaction details
Example:
Status of the verification request
Transaction details including status, amount, and customer information
verifyTransactionXrequery()
Verifies a transaction using the cross-verification (xrequery) endpoint. This method provides additional verification options including filtering for only successful transactions and the last attempt.JSONObject - The verification response with detailed transaction information
Example:
Status of the xrequery request
Comprehensive transaction details with charge codes and transaction metadata
Usage Example
Notes
- The secret key (
SECKEY) is automatically retrieved fromRaveConstant.SECRET_KEY - The xrequery method automatically sets
last_attempt=1andonly_successful=1parameters - Both methods return JSONObject responses that should be checked for success status before processing
- Method chaining is supported for all setter methods