Skip to main content
The Disputes API gathers every dispute on your sales in one place, so you can handle them where you already work, for example in your helpdesk. You read the same thread you see on dhmad.tn → Support, and what you post through the API appears there too: the payer sees it, and so does DHMAD. Every /v1/disputes endpoint needs an API key with Disputes access, which keys do not have by default. See Permissions.

Which disputes you see

You see the disputes on sales made by your developer account’s business:
  • disputes on your charges;
  • disputes on escrows where your business is the seller;
  • chargebacks held against your business.
You do not see disputes on escrows you created through the API for another seller (that seller answers them), or disputes where your business is the buyer. Asking for one of those returns 404 DISPUTE_NOT_FOUND, the same as an id that does not exist.

Kinds of dispute

kind says what the dispute is and who decides it.

Charge disputes

Charge disputes work like PayPal’s: the payment stays held, you and the payer talk it out, and DHMAD decides only if one of you asks.
  1. When the payer opens a dispute, the two of you have 20 days to settle it on the dispute thread. Messages on the thread never move or reset this deadline (deadlines.closesAt). You can accept the dispute, which refunds the payer in full, at any time.
  2. Before the 20 days end, either side can ask DHMAD to decide (Escalate Dispute, or a button on the dispute thread and on the payer’s protect page). You then have 7 days to send DHMAD your side on the thread (deadlines.merchantReplyBy). If you don’t, DHMAD refunds the payer in full. Once your side is in, DHMAD decides and either refunds the payer or releases the payment to you.
  3. If nobody asks DHMAD to decide within the 20 days, the dispute closes and the payment is released to your wallet.
DHMAD can also take a dispute for review at any time (deadlines.escalatedBy: "support"). See also Dispute deadline.

Chargebacks

DHMAD holds back the disputed amount and asks for your evidence before chargeback.merchantDueAt. Tell DHMAD what to do with Chargeback Response:
  • Contest: send your evidence as messages (proof of delivery, your conversation with the payer, the terms they accepted). DHMAD sends it to PayPal, and the card issuer decides.
  • Accept: DHMAD accepts the claim with PayPal, and the payer keeps the money.
What is held, what is taken back and PayPal’s fee work as described in Chargebacks; the charge.chargeback.opened and charge.chargeback.resolved webhooks still fire as before.

Escrow disputes

DHMAD reviews the dispute and decides what happens to the escrow money. Reply on the thread with your side and your evidence. You cannot escalate an escrow dispute: DHMAD already has it.

Status and outcome

Actions

actions says what you can do now. Check it instead of working it out from status.

Permissions

The disputes endpoints return your payers’ names, emails, messages and documents, so a key needs Disputes access to reach them. Keys have none by default: a key pasted into a WooCommerce or PrestaShop plugin cannot read disputes unless you turn it on. Set it per key in the Developer Dashboard → API Keys. A key without the access it needs gets 403 API_KEY_PERMISSION_REQUIRED. See API key permissions.

What is never included

The API shows the thread as you see it on dhmad.tn. It never includes DHMAD’s internal notes or how DHMAD organises its work (who is assigned, queues, priorities). Messages from DHMAD’s team are signed DHMAD, never with an agent’s name. A payer who has no DHMAD account appears by email only, with no name.

Sync to your helpdesk

1

Give a key Disputes access

Read is enough to import disputes. Choose Read & reply if your helpdesk answers them too.
2

Hear about changes

Subscribe to dispute.opened, dispute.message.created and dispute.updated. Or poll GET /v1/disputes?updatedSince= with the time of your last sync (take a few minutes off it; duplicates are harmless when you key on id).
3

Import the thread

For each new or changed dispute, fetch GET /v1/disputes/:id. Store each message by its id, and update its body when edited is true: DHMAD’s team can correct a message it sent, which sends no webhook but moves lastActivityAt.
4

Reply from your helpdesk

Post your agents’ replies with POST /v1/disputes/:id/messages and an Idempotency-Key (your helpdesk’s reply id works well), so a retry never posts twice. Your own replies come back in dispute.message.created with message.source: "api": skip those.
Run one full sync with GET /v1/disputes when you start: disputes opened before the dispute webhooks were switched on never send dispute.opened (their later messages and changes are sent as usual). Attachment links are signed and expire (urlExpiresAt): download the files when you import a message, or fetch the dispute again for fresh links.

Test in the sandbox

On the sandbox, make a payer act on a charge you created with POST /api/v1/sandbox/charges/:id/simulate:
They send the same webhooks as a real payer’s actions. Chargebacks cannot be simulated. See Simulate charge events.