Testing
Test your API integration with custom data.
Data Retention
To keep our integration test environment fast and efficient, we'll archive your test data after 30 days. This helps us maintain top performance! Just a heads-up that once data is archived, it can't be accessed again.
Use the X-Scenario-Key header to simulate different test scenarios in the sandbox environment. Check out the sections below to see supported scenario keys.
Cards
To test card transactions, pass a scenario key in this format:
scenario:<value>&issuer:<value>
scenariodefines the authentication flow you want to test.issuerdefines the processor response to simulate.
Default Card Testing
If you omit the
X-Scenario-Keyheader, the card transaction defaults to anoauthflow.
curl --request POST \
--url 'https://developersandbox-api.flutterwave.com/charges' \
--header 'Authorization: Bearer {{YOUR_ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--header 'X-Trace-Id: {{YOUR_UNIQUE_TRACE_ID}}' \
--header 'X-Scenario-Key: scenario:<value>&issuer:<value>' \
--data '{}
'
Supported Card Scenarios
| Scenario | Meaning |
|---|---|
auth_pin | Mock PIN authentication. Prompts the customer to enter their PIN and OTP. |
auth_pin_3ds | Mock a failover from PIN to 3DS. The customer first enters their PIN, then gets redirected to the 3DS flow. |
auth_3ds | Mock a 3DS authentication. Returns a redirect URL to send the customer to their bank for charge authorization. |
auth_avs | Mock the noauth (AVS) flow. Prompts the customer to enter their billing address to complete the payment. |
Mocking Different Issuer Responses
You can simulate different issuer responses for each authentication model. These represent actual responses from providers after payment processing. Use these to test failure, success, and edge cases.
We recommend that you test as much as you can to build high reliability for your application. Here are the available issuer response values:
already_reversedapprovedblocked_first_usecannot_complete_violation_of_lawcannot_verify_pindo_not_honorerrorexceeds_approval_amount_limitexceeds_withdrawal_limitexpired_cardfile_temporarily_not_availableincorrect_pininsufficient_fundsinvalid_account_numberinvalid_amountinvalid_cvvinvalid_merchantinvalid_restricted_service_codeinvalid_transactionissuer_unavailablelost_card_pick_upnegative_cvv_resultno_action_takenno_checking_accountno_reason_to_declineno_savings_accountno_such_issuerpartial_approvalpick_up_card_fraudpick_up_card_no_fraudpin_data_requiredpin_entry_tries_exceededrefer_to_issuerrefer_to_issuer_special_conditionreenter_transactionsecurity_violationstolen_card_pick_upsuspected_fraudsystem_errortransaction_does_not_fulfill_aml_reqtransaction_not_permitted_cardtransaction_not_permitted_terminalunable_to_locate_record_in_fileunable_to_route_transactionunsolicited_reversal
Example
You can mock a successful 3D Secure (3DS) transaction by specifying the scenario:auth_3ds&issuer:approved key:
// Successful 3DS transaction
curl --request POST \
--url 'https://developersandbox-api.flutterwave.com/charges' \
--header 'Authorization: Bearer {{YOUR_ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--header 'X-Trace-Id: {{YOUR_UNIQUE_TRACE_ID}}' \
--header 'X-Scenario-Key: scenario:auth_3ds&issuer:approved' \
--data '{}
'
Mock a failed transaction due to an incorrect PIN:
// Incorrect pin transaction
curl --request POST \
--url 'https://developersandbox-api.flutterwave.com/charges' \
--header 'Authorization: Bearer {{YOUR_ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--header 'X-Trace-Id: {{YOUR_UNIQUE_TRACE_ID}}' \
--header 'X-Scenario-Key: scenario:auth_pin&issuer:incorrect_pin' \
--data '{}
'
Mock a declined transaction due to insufficient funds during Address Verification System (AVS) checks:
// Insufficient funds AVS transaction
curl --request POST \
--url 'https://developersandbox-api.flutterwave.com/charges' \
--header 'Authorization: Bearer {{YOUR_ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--header 'X-Trace-Id: {{YOUR_UNIQUE_TRACE_ID}}' \
--header 'X-Scenario-Key: scenario:auth_avs&issuer:insufficient_funds' \
--data '{}
'
Mobile Money
Test Mobile Money transactions using one of two flows:
- The default flow prompts the customer to authorize payment via a notification on their mobile device.
- The redirect flow sends the customer to an authorization page.
Scenario 1 is the default flow for mobile money on the sandbox environment. To trigger this scenario, you don't need to pass the X-Scenario-Key header in your request.
To simulate the redirect flow, pass scenario:auth_redirect in the header.
// Redirect auth for Mobile Money transactions
curl --request POST \
--url 'https://developersandbox-api.flutterwave.com/charges' \
--header 'Authorization: Bearer {{YOUR_ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--header 'X-Trace-Id: {{YOUR_UNIQUE_TRACE_ID}}' \
--header 'X-Scenario-Key: scenario:auth_redirect' \
--data '{}
'
Transfers
Test transfer transactions the same way as card transactions: define a scenario using the X-Scenario-Key header.
Available transfer scenarios:
successfulaccount_resolved_failedamount_below_limit_erroramount_exceed_limit_errorblocked_bankcurrency_amount_below_limitcurrency_amount_exceed_limitday_limit_errorday_transfer_limit_exceededdisabled_transferduplicate_referencefile_too_largeinsufficient_balanceinvalid_amountinvalid_amount_validationinvalid_bulk_datainvalid_currencyinvalid_payoutsinvalid_referenceinvalid_reference_lengthinvalid_wallet_currencymonth_limit_errormonth_transfer_limit_exceededno_account_foundpayout_creation_errorunavailable_transfer_option
Example
You can mock a successful transfer request using the scenario:successful key:
// Successful transfer
curl --request POST \
--url 'https://developersandbox-api.flutterwave.com/transfers' \
--header 'Authorization: Bearer {{YOUR_ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--header 'X-Trace-Id: {{YOUR_UNIQUE_TRACE_ID}}' \
--header 'X-Scenario-Key: scenario:successful' \
--data '{}
'
Mock a failed transfer due to an invalid currency:
// Invalid Currency
curl --request POST \
--url 'https://developersandbox-api.flutterwave.com/transfers' \
--header 'Authorization: Bearer {{YOUR_ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--header 'X-Trace-Id: {{YOUR_UNIQUE_TRACE_ID}}' \
--header 'X-Scenario-Key: scenario:invalid_currency' \
--data '{}
'
Mock a failed transfer caused by insufficient balance:
// Insufficient balance
curl --request POST \
--url 'https://developersandbox-api.flutterwave.com/transfers' \
--header 'Authorization: Bearer {{YOUR_ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--header 'X-Trace-Id: {{YOUR_UNIQUE_TRACE_ID}}' \
--header 'X-Scenario-Key: scenario:insufficient_balance' \
--data '{}
'
Default Transfer Testing
If you do not pass the
X-Scenario-Keyheader, the transfer remains in apendingstate and no webhook is sent for the test.
Updated 18 days ago
