> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dhmad.tn/llms.txt
> Use this file to discover all available pages before exploring further.

# Accept Dispute

> Accept the payer's dispute and refund the charge in full

**/api/v1/charges/:id/dispute/accept**

During the 72-hour hold, the payer can open a dispute on a charge. While it is open, the charge has `fundsStatus: "disputed"`, its release to your wallet waits, and [Refund Charge](https://docs.dhmad.tn/api-reference/charges/create-refund.md) returns **409** `CHARGE_DISPUTED`.

Accept the dispute to settle it yourself: DHMAD refunds the payer everything still refundable, with reason `dispute_accepted`, and closes the dispute. There is no `amount` — accepting always refunds what is left (a partial refund you made earlier is not refunded again).

## Dispute deadline

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 (dhmad.tn → Support, the DHMAD app, or the [Disputes API](https://docs.dhmad.tn/api-reference/disputes/overview.md)). Messages on the thread never move or reset this deadline. You can accept the dispute, or refund, at any time. Your business's owner and admins get an email and a notification with the closing date; the payer gets reminders 3 days and 1 day before it.
2. Before the 20 days end, either side can **ask DHMAD to decide** (a button on the dispute thread and on the payer's protect page, or [Escalate Dispute](https://docs.dhmad.tn/api-reference/disputes/escalate-dispute.md)). You then have **7 days** to send DHMAD your side on the thread. If you don't, DHMAD refunds the payer in full: the refund has `reason: "dispute_unanswered"` and `initiatedBy: "dispute_timeout"`, and you receive `charge.refunded`. 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: you receive `charge.funds.released`.

DHMAD can also take a dispute for review at any time. `charge.dispute.stage`, `closesAt`, `escalatedBy` and `merchantReplyBy` say where the dispute stands.

`:id` accepts the DHMAD charge id or your `merchantReference`. Accepting from the dashboard does the same thing.

The refund comes out of the held payment, so DHMAD's fee on it is waived, and the payer gets the money back the same way as any refund (see [How the payer gets the money back](https://docs.dhmad.tn/api-reference/charges/create-refund.md#how-the-payer-gets-the-money-back)). You receive the **`charge.refunded`** webhook, then **`charge.refund.updated`** as the refund completes.

To read the thread and reply to the payer from your own tools, use the [Disputes API](https://docs.dhmad.tn/api-reference/disputes/overview.md). A dispute there with `actions.accept: true` is accepted with this endpoint, using its `charge.id`.

> [!NOTE]
>
> This is the dispute the payer opens with DHMAD. A dispute the payer opens with PayPal or their bank is a **chargeback**, which PayPal decides — see [Chargebacks](https://docs.dhmad.tn/api-reference/charges/overview.md#chargebacks).

## Who opened the dispute

`charge.dispute` says who reported it, what they wrote, and when. The same object is on [Get Charge](https://docs.dhmad.tn/api-reference/charges/get-charge.md) and on the **`charge.dispute.opened`** [webhook](https://docs.dhmad.tn/guides/webhooks.md#chargedisputeopened), so you can show it before deciding.

The payer's email: their DHMAD account email, or the email a guest payer gave when opening the dispute.

The payer's name when they have a DHMAD account; `null` for a guest payer.

The payer's first message on the dispute.

The reason the payer chose when opening the dispute: `not_received`, `not_as_described`, `refund_not_received`, `wrong_amount`, `unauthorized` or `other`. `null` on disputes opened before 15 November 2026.

What the payer said about contacting you first: `no_reply` (you did not answer), `not_resolved` (you talked but did not sort it out), `not_contacted` (only allowed for a payment they say they did not make, or when DHMAD cannot reach you) or `unrecognized` (they do not recognise the payment). `null` on disputes opened before 15 November 2026.

When the dispute was opened (ISO 8601).

The DHMAD support ticket for the dispute (for example `DH-2026-01234`).

`open`: you and the payer talk it out until `closesAt`. `review`: someone asked DHMAD to decide, and DHMAD decides. `null` once the dispute is settled.

While `open` (ISO 8601): unless you or the payer ask DHMAD to decide by then, the dispute closes and the payment is released to you. `null` in review and once settled.

In review: who asked DHMAD to decide, `merchant` (you), `payer`, or `support` (DHMAD took it). `null` while open and once settled.

In review (ISO 8601): send DHMAD your side on the dispute thread by then, or the payer is refunded in full. `null` once your side is in, when DHMAD did not ask for it, and once settled.

## Idempotency

Send an `Idempotency-Key` header so a retried request returns the original refund with **200** and `"idempotentReplay": true`. Without one, DHMAD uses a single key per charge — the one the dashboard uses too — so a retry, or an accept from both the dashboard and the API, never refunds twice. A retry with a different `note` returns **409** `IDEMPOTENCY_KEY_REUSED`.

## Request body

The body is optional; an empty body accepts the dispute.

**note** `string`

Message posted on the dispute for the payer (max 500 characters). Also kept with the refund.

```bash cURL theme={null}
curl -X POST https://dhmad.tn/api/v1/charges/purchase_65f1c2a9b1/dispute/accept \
  -H "Authorization: Bearer sk_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 9c6b0d2e-dispute-1" \
  -d '{ "note": "Sorry about that, we have refunded you in full." }'
```

```javascript JavaScript theme={null}
const response = await fetch(
  'https://dhmad.tn/api/v1/charges/purchase_65f1c2a9b1/dispute/accept',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_live_your_api_key_here',
      'Content-Type': 'application/json',
      'Idempotency-Key': '9c6b0d2e-dispute-1'
    },
    body: JSON.stringify({ note: 'Sorry about that, we have refunded you in full.' })
  }
);

const { refund, charge } = await response.json();
```

```python Python theme={null}
import requests

response = requests.post(
    'https://dhmad.tn/api/v1/charges/purchase_65f1c2a9b1/dispute/accept',
    headers={
        'Authorization': 'Bearer sk_live_your_api_key_here',
        'Idempotency-Key': '9c6b0d2e-dispute-1',
    },
    json={'note': 'Sorry about that, we have refunded you in full.'},
)

refund = response.json()['refund']
```

```json theme={null}
{
  "refund": {
    "id": "6650a1f2c3d4e5f6a7b8c9e1",
    "chargeId": "507f1f77bcf86cd799439011",
    "amount": 120,
    "currency": "TND",
    "amountTnd": 120,
    "payerAmountTnd": 120,
    "feeRefundedTnd": 0,
    "source": "hold",
    "isFull": true,
    "reason": "dispute_accepted",
    "status": "pending",
    "initiatedBy": "dispute_accept",
    "merchantRefundReference": null,
    "destinations": [
      { "type": "paypal", "amountTnd": 120, "status": "pending", "chargebackHold": null }
    ],
    "createdAt": "2026-01-16T09:00:00.000Z",
    "updatedAt": "2026-01-16T09:00:00.000Z"
  },
  "charge": {
    "id": "507f1f77bcf86cd799439011",
    "merchantReference": "purchase_65f1c2a9b1",
    "status": "cancelled",
    "amount": 120,
    "amountRefunded": 120,
    "amountRefundable": 0,
    "refundStatus": "full",
    "fundsStatus": "refunded",
    "dispute": {
      "reportedBy": { "email": "payer@example.com", "name": "Sami Ben Ali" },
      "reason": "I paid twice for the same credits.",
      "openedAt": "2026-01-15T18:40:00.000Z",
      "ticketNumber": "DH-2026-01234"
    }
  }
}
```

## Path Parameters

**id** `string` *required*

Charge id or `merchantReference`.

## Errors

Errors carry the code in `error` and `code`, with a readable `message`:

```json theme={null}
{ "error": "DISPUTE_NOT_OPEN", "code": "DISPUTE_NOT_OPEN", "message": "This charge has no open dispute" }
```

| Status | Code | Meaning |
| - | - | - |
| 404 | `CHARGE_NOT_FOUND` | No charge with this id / reference for your account |
| 409 | `DISPUTE_NOT_OPEN` | The charge has no open dispute (none was opened, it was already resolved, or the funds were released) |
| 409 | `CHARGE_NOT_PAID` | The charge was never paid |
| 409 | `CHARGE_FULLY_REFUNDED` | Nothing left to refund |
| 409 | `CHARGE_UNDER_REVIEW` / `CHARGE_SETTLEMENT_PENDING` | Contact DHMAD support |
| 409 | `CHARGE_STATE_CHANGED` | The charge changed during the request; fetch it and retry |
| 409 | `IDEMPOTENCY_KEY_REUSED` | Key reused with a different request |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.