Flutterwave refunds¶
PayBridge supports full and partial Flutterwave refunds through Flutterwave's v3 transaction refund API.
The SDK accepts the merchant transaction reference (tx_ref) used throughout
PayBridge. Before creating the refund, it queries Flutterwave's
verify_by_reference endpoint and uses the returned numeric data.id in:
POST /v3/transactions/{id}/refund
The amount is sent in the currency's major unit, matching Flutterwave's payment and refund APIs. PayBridge always sends an explicit amount:
- an amount equal to the verified transaction amount is a full refund;
- a smaller amount is a partial refund;
- an amount greater than the verified transaction is rejected before the refund request is sent.
A bare completed from Flutterwave v3 means the refund is awaiting
disbursement. It maps to PaymentStatus.Pending, along with new,
pending, processing, pending-momo, pending-bank-transfer, and
pending-mpgs. Unknown or missing statuses also stay pending: confirm the
current status with Flutterwave using the refund reference before taking
further action.
Only completed-bank-transfer, completed-momo, completed-mpgs,
completed-offline, and completed-preauth map to PaymentStatus.Refunded.
Explicit provider failures map to PaymentStatus.Failed.
Sandbox verification¶
The integration test is deliberately opt-in because a successful refund consumes the refundable balance of its transaction. Configure only sandbox values:
FLUTTERWAVE_SECRET_KEY
FLUTTERWAVE_REFUND_TRANSACTION_REFERENCE
FLUTTERWAVE_REFUND_AMOUNT
FLUTTERWAVE_REFUND_TRANSACTION_REFERENCE must identify a dedicated successful
sandbox payment. Replace the fixture after each accepted refund. Never use
live credentials or a customer transaction.
To run in GitHub Actions, add these names to the integration environment
secrets. Open Integration Tests, select Run workflow, and choose
flutterwave. The scheduled run and the default all selection exclude
the refund suite. Use a test-mode secret key beginning with FLWSECK_TEST-.
The workflow summary and test artefact record whether the refund was accepted.
A pending status can still require reconciliation with Flutterwave.
To run the test locally:
dotnet test PayBridge.SDK.Test/PayBridge.SDK.Test.csproj \
--filter FullyQualifiedName~FlutterwaveRefundIntegrationTests
Official references: