:id accepts the DHMAD charge id or your merchantReference. Omit amount to refund everything still refundable; send a smaller amount for a partial refund. You can refund a charge several times until nothing is left.
Where the money comes from
If your available balance cannot cover a refund after release, the request fails with 400
REFUND_AMOUNT_EXCEEDS_BALANCE (it includes availableTnd and shortfallTnd). Charges can be refunded up to 90 days after payment.
While the payer has an open dispute (fundsStatus: "disputed"), refunds return 409 CHARGE_DISPUTED. Accept the dispute with Accept Dispute (or from the dashboard), which refunds the full amount, or let DHMAD resolve it.
How the payer gets the money back
Each refund lists itsdestinations:
wallet— credited to the payer’s DHMAD wallet immediately: the part they paid from their wallet, and everything else too when they paid while logged in to DHMAD (except card / PayPal, which goes back to the card).paypal— card, PayPal and Apple Pay payments are refunded automatically through PayPal. Banks can take 5–10 business days to show it.manual— D17, bank transfer and cash payments by a guest payer (and Flouci payments made before Flouci was retired): DHMAD emails them to choose where to receive the refund (D17 or bank transfer, confirmed with an emailed code), then sends it. Flouci is no longer a refund destination: a destination that names it is refused with 400PAYMENT_METHOD_RETIRED. Any transfer fee is deducted from what the payer receives. A payer whose email has a verified DHMAD account can instead log in and take it into their wallet instantly (the destination then becomeswallet).sandbox— sandbox charges refund instantly.
status is pending, awaiting_payer_details, awaiting_manual_payout, succeeded, or failed (DHMAD follows up on failed payouts). Subscribe to charge.refunded and charge.refund.updated to follow it — see Webhooks.
Refunds during a chargeback
While a chargeback is open on the payment (aftercharge.chargeback.opened, before charge.chargeback.resolved), the refund is still created (201) and booked, but its paypal part is not sent, because the payer’s bank may pay them back too. That destination stays pending with chargebackHold:
- Case won — the refund goes to the card (
result: "sent"). - Case lost — the bank already paid the payer, so the destination becomes
succeededwithresult: "covered": your refund pays the chargeback instead and you are not charged twice (after release, the reserve the chargeback held on your balance comes back).
succeeded with result: "sent" while the case is still open, and the case amount no longer includes it. Each change sends charge.refund.updated. chargebackHold is null on destinations no chargeback held.
Idempotency
Send anIdempotency-Key header, or your own merchantRefundReference (unique per charge). Retrying with the same key returns the original refund with "idempotentReplay": true and 200; reusing a key for a different request returns 409 IDEMPOTENCY_KEY_REUSED.
Request body
Amount to refund in the charge currency. Omit for a full refund. Partial refunds are at least 1 TND (or the equivalent); the full remaining amount is always allowed.
Errors
Errors carry the code inerror and code, with a readable message and any details:

