# Respond to a dispute

> Send evidence, concede, or talk to the payer.

## Respond with evidence

This is the part that decides the outcome, and it is worth being thorough. Each piece of evidence
is filed under a type, and you can post several calls to build up a case.

`POST /disputes/{id}/submit-evidence`

- `evidence_type` (enum, required): One of `customer_communication`, `proof_of_delivery`, `service_documentation`, `receipt`, `product_description`, `cancellation_policy`, `refund_policy`, `duplicate_charge_documentation`, `other`.
- `evidence_text` (string): Your written argument for this piece, up to 2 000 characters.
- `evidence_file` (file): One file: PDF, JPG, JPEG, PNG, DOC, DOCX or TXT, 10 MB at most. Send the call as `multipart/form-data`.

The type is a slot, not a label. Post twice with `proof_of_delivery` and the second call replaces
the first, it does not add to it. Use a different type for each distinct piece, and put everything
you want to say about one piece into that one call.

Send a text, a file, or both: a call with neither answers `422`, and the dispute stays where it
was. Without a file, the piece is stored as your text alone: `evidence.proof_of_delivery` is then a
string rather than an object. The name you gave a file comes back as `file_name`.

Files are private: no address opens one on its own. Every answer of the API that returns the
dispute gives each file, evidence and message attachments alike, a `url`, a signed link valid 30
minutes. Past that, read the dispute again for a fresh one. A webhook carries `file_path` and no
link.

Because a file is involved, this is a form upload rather than a JSON body.

**Submit proof of delivery**

```bash
curl https://api.wajub.com/disputes/dsp_hrgUOE225KMKULRQqYvlh/submit-evidence \
  -H "Authorization: sk.xxxxxxxxxxxxxxxx…" \
  -F "evidence_type=proof_of_delivery" \
  -F "evidence_text=Delivered 12 Sept, signed for by the customer." \
  -F "evidence_file=@/path/to/delivery-note.pdf"
```

```javascript
import { readFile } from 'node:fs/promises';

// Text alone goes through the SDK, as JSON.
const dispute = await wajub.disputes.submitEvidence('dsp_hrgUOE225KMKULRQqYvlh', {
  evidence_type: 'proof_of_delivery',
  evidence_text: 'Delivered 12 Sept, signed for by the customer.',
});

console.log(dispute.status);

// A file needs multipart/form-data, which the SDK does not send.
// Post the form yourself instead of the call above.
const form = new FormData();

form.set('evidence_type', 'proof_of_delivery');
form.set('evidence_text', 'Delivered 12 Sept, signed for by the customer.');
form.set(
  'evidence_file',
  new Blob([await readFile('./delivery-note.pdf')], { type: 'application/pdf' }),
  'delivery-note.pdf',
);

const response = await fetch('https://api.wajub.com/disputes/dsp_hrgUOE225KMKULRQqYvlh/submit-evidence', {
  method: 'POST',
  headers: { Authorization: process.env.WAJUB_API_KEY, Accept: 'application/json' },
  body: form,
});

if (!response.ok) {
  throw new Error('Evidence refused: ' + response.status);
}

const body = await response.json();

console.log(body.dispute.status);
```

```python
import os

import httpx

# Text alone goes through the SDK, as JSON.
dispute = wajub.disputes.submit_evidence(
    "dsp_hrgUOE225KMKULRQqYvlh",
    {
        "evidence_type": "proof_of_delivery",
        "evidence_text": "Delivered 12 Sept, signed for by the customer.",
    },
)

print(dispute["status"])

# A file needs multipart/form-data, which the SDK does not send.
# Post the form yourself instead of the call above.
with open("delivery-note.pdf", "rb") as f:
    response = httpx.post(
        "https://api.wajub.com/disputes/dsp_hrgUOE225KMKULRQqYvlh/submit-evidence",
        headers={"Authorization": os.environ["WAJUB_API_KEY"], "Accept": "application/json"},
        data={
            "evidence_type": "proof_of_delivery",
            "evidence_text": "Delivered 12 Sept, signed for by the customer.",
        },
        files={"evidence_file": ("delivery-note.pdf", f, "application/pdf")},
    )

response.raise_for_status()

print(response.json()["dispute"]["status"])
```

```php
use GuzzleHttp\Client;

// Text alone goes through the SDK, as JSON.
$dispute = $wajub->disputes->submitEvidence('dsp_hrgUOE225KMKULRQqYvlh', [
  'evidence_type' => 'proof_of_delivery',
  'evidence_text' => 'Delivered 12 Sept, signed for by the customer.',
]);

echo $dispute['status'];

// A file needs multipart/form-data, which the SDK does not send.
// Post the form yourself instead of the call above, with the Guzzle
// client the SDK already installed.
$response = (new Client())->post(
  'https://api.wajub.com/disputes/dsp_hrgUOE225KMKULRQqYvlh/submit-evidence',
  [
    'headers' => [
      'Authorization' => getenv('WAJUB_API_KEY'),
      'Accept' => 'application/json',
    ],
    'multipart' => [
      ['name' => 'evidence_type', 'contents' => 'proof_of_delivery'],
      ['name' => 'evidence_text', 'contents' => 'Delivered 12 Sept, signed for by the customer.'],
      [
        'name' => 'evidence_file',
        'contents' => fopen('delivery-note.pdf', 'r'),
        'filename' => 'delivery-note.pdf',
      ],
    ],
  ],
);

$body = json_decode((string) $response->getBody(), true);

echo $body['dispute']['status'];
```

```go
// Text alone goes through the SDK, as JSON.
dispute, err := client.Disputes.SubmitEvidence(context.Background(), "dsp_hrgUOE225KMKULRQqYvlh", map[string]any{
	"evidence_type": "proof_of_delivery",
	"evidence_text": "Delivered 12 Sept, signed for by the customer.",
}, nil)

if err != nil {
	log.Fatal(err)
}

log.Println(dispute["status"])

// A file needs multipart/form-data, which the SDK does not send.
// Post the form yourself instead of the call above.
file, err := os.Open("delivery-note.pdf")

if err != nil {
	log.Fatal(err)
}

defer file.Close()

var form bytes.Buffer
writer := multipart.NewWriter(&form)

writer.WriteField("evidence_type", "proof_of_delivery")
writer.WriteField("evidence_text", "Delivered 12 Sept, signed for by the customer.")

part, err := writer.CreateFormFile("evidence_file", "delivery-note.pdf")

if err != nil {
	log.Fatal(err)
}

if _, err := io.Copy(part, file); err != nil {
	log.Fatal(err)
}

writer.Close()

req, err := http.NewRequest(
	http.MethodPost,
	"https://api.wajub.com/disputes/dsp_hrgUOE225KMKULRQqYvlh/submit-evidence",
	&form,
)

if err != nil {
	log.Fatal(err)
}

req.Header.Set("Authorization", os.Getenv("WAJUB_API_KEY"))
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", writer.FormDataContentType())

res, err := http.DefaultClient.Do(req)

if err != nil {
	log.Fatal(err)
}

defer res.Body.Close()

log.Println(res.Status)
```

The call answers `200 OK` with the dispute as it now stands, already moved to `under_review`, and
your evidence collected under `evidence`.

```json title="Response · 200 OK"
{
  "code": 200,
  "status": "OK",
  "message": "Evidence submitted successfully",
  "dispute": {
    "id": "dsp_hrgUOE225KMKULRQqYvlh",
    "transaction": "trx_CSUGajfv9xh0XQ5wu2lx",
    "customer": "cus_sAaim5apjocIgtlhzJY3wQ8s",
    "amount": 25000,
    "currency": "XAF",
    "status": "under_review",
    "reason": "product_not_received",
    "evidence": {
      "proof_of_delivery": {
        "text": "Delivered 12 Sept, signed for by the customer.",
        "file_path": "…",
        "file_name": "delivery-note.pdf",
        "uploaded_at": "2026-09-11T12:04:00+00:00",
        "url": "https://…?signature=…"
      }
    },
    "sandbox": false,
    "created_at": "2026-09-11T12:00:00+00:00"
  }
}
```

Evidence can only be filed while the dispute is `open` or `under_review`. Once it is `won` or
`lost`, the call answers `422` and the case is shut.

> [!WARNING]
> **Evidence stays with Wajub**
>
> When a dispute's `evidence_reaches_provider` is `false`, what you
> file is recorded at Wajub and read by the people who rule on a Pocket dispute. It is not forwarded
> to the provider or the card network, so on a chargeback your defence has to go to the provider
> through your own account with them.

## Conceding, and a call that does not do what its name suggests

If the payer is right, concede early rather than letting it run.

`POST /disputes/{id}/accept`

Accepting takes an optional `merchant_response`, up to 2 000 characters, which is recorded against
the dispute. It sets the dispute to `lost` immediately and there is no way back, and it sends the
money back to the payer: Wajub creates a refund of the disputed amount, capped to what is still
refundable on the payment.

That refund carries the reason `customer_complaint` and the dispute's own reason in
`metadata.dispute_reason`, and it gives the payer back everything they paid for that amount, a fee
they paid on top included. If the refund cannot be created, the call fails and the dispute stays as
it was.

Three cases create no refund, and the dispute still ends `lost`:

- **A chargeback.** The payer's bank has already returned the money, so a refund would pay the
  payer twice.
- **Nothing left to refund.** Earlier refunds already returned the whole payment.
- **A dispute in another currency than its payment.** There is no amount to refund in the payment's
  own currency.

> [!CAUTION]
> **close is accept under another name**
>
> `POST /disputes/{id}/close` is not a neutral way to tidy a dispute away. It has exactly the same
> effect as `accept`: the dispute becomes `lost`, the payer is refunded unless it is a chargeback,
> and the outcome is final. If you were looking for a call that dismisses a dispute in your favour,
> there isn't one. Submit evidence instead.

## Talk to the payer

A dispute carries a message thread, opened by the payer's own description. You can reply on it.

`POST /disputes/{id}/messages`

Messages take `content`, required and up to 5 000 characters, and an optional `attachments` array
of files under the same limits as evidence. Each attachment comes back with `file_name`,
`file_path` and the same 30-minute `url`. `POST /disputes/{id}/send-message` is an alias for the
same thing. Your messages are recorded with a `sender_type` of `merchant`, the payer's with
`customer`, and the whole thread comes back on a retrieve. The thread stays open after the outcome:
a message on a dispute already `won` or `lost` is accepted and recorded, but changes nothing about
the result.

- [Track disputes](https://docs.wajub.com/payments/disputes/track): Read them and their webhooks.
- [Disputes API reference](https://docs.wajub.com/api/disputes): Every dispute endpoint.
