Create a refund
/api/v1/refundsSends money back to the number that paid a succeeded collection. The refund goes out as a payout to that number. You cannot name another number.
Leave out amount to refund everything not yet refunded. You can refund a payment in several parts, up to its amount in total. A refund is also refused as too large when part of the payment was already used, for example credit from it that went to an invoice. The error names the amount still left to refund, and a request without an amount refunds that amount.
For a payment of an invoice you can name the invoice lines to refund, for example only the fee line, with an amount for each. The refund is then the sum of the lines, and the credit note it issues names them. A refund, by line or in full, changes nothing on the subscription and bills nothing again.
When you create the refund, your available balance must cover the refund amount and the payout fee. If it does not, the request is refused and nothing is sent. Nothing is held at that point: the amount and fee are held from your balance when the payout starts. If the balance has fallen below that total by then, the payout does not start and the refund is failed. The fee on the original payment is not returned. The refund is pending until the payout finishes, then succeeded, or failed with any held money back in your balance.
A payment can be refunded for 1 year after it succeeded, on a network that can pay out. Needs the refunds.write scope. Send a unique Idempotency-Key: repeating it does not refund twice.
Authorization
bearerAuth An access token from POST /api/v1/oauth/token, sent as Authorization: Bearer <token>.
In: header
Header Parameters
A unique key you choose for this request: 1 to 255 visible ASCII characters, no spaces. A UUID works well. Never put personal data, such as a phone number or an email address, in it. Send the same key again to retry safely.
The API version to use for this request, a date such as 2026-11-06. Without it the request uses your default version for the mode of your key. An unknown version answers 400 api_version_invalid.
Value in
- "2026-11-06"
Request Body
application/json
A refund to create.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api-malipo.flex.co.tz/api/v1/refunds" \ -H "Authorization: Bearer <token>" \ -H "Idempotency-Key: 7a3d2b10-5c4e-4f1a-8b6d-9e0f1a2b3c4d" \ -H "FlexMalipo-Version: 2026-11-06" \ -H "Content-Type: application/json" \ -d '{ "payment": "0b6f3c1e-8f2a-4a51-9a57-6d1f0c2b7e93", "reason": "requested_by_customer" }'{ "id": "6d2b1f4e-3c55-4e0a-b1c6-0f6a9d7e5a21", "status": "pending", "payment": "0b6f3c1e-8f2a-4a51-9a57-6d1f0c2b7e93", "amount": 4000, "fee": 1500, "currency": "TZS", "reason": "requested_by_customer", "livemode": false, "createdAt": "2026-09-29T08:00:00Z"}