# Create refund

The merchant refunds a payment, in full or in part, by intent_id or dispute_id; the rail sends it back to the payer and a refund receipt is issued. Merchant owner with dispute:respond only; a failed send answers 503.

`POST /v1/refunds`

The merchant refunds a payment, in full or in part, by intent_id or dispute_id; the rail sends it back to the payer and a refund receipt is issued. Merchant owner with dispute:respond only; a failed send answers 503.

Requires permission `dispute:respond`.

## Request body

```json
{
  "intent_id": "pi_01jd2x3k4m5n6p7q8r9s0t1v2w",
  "dispute_id": "dsp_01jd2x3k4m5n6p7q8r9s0t1v2w",
  "amount_base_units": "50000"
}
```

## Responses

- **200**: Success.
- **400**: Invalid request: a field is missing or malformed (VALIDATION_ERROR).
- **401**: No valid session, API key or agent credential (UNAUTHENTICATED, AGENT_CREDENTIAL_INVALID).
- **403**: Authenticated but not allowed: missing permission, passkey step-up required, or denied by policy.
- **404**: The resource does not exist or belongs to another organization.

Example 200 response:

```json
{
  "refund": {
    "id": "id_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "org_id": "org_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "dispute_id": "dsp_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "intent_id": "pi_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "amount_base_units": "50000",
    "amount_display": "string",
    "asset": "USDC",
    "failure_reason": "string",
    "status": "active",
    "rail": "x402",
    "source": "string",
    "tx_ref": "string",
    "receipt_id": "rcpt_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "simulated": true
  },
  "intent": {
    "id": "id_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "status": "active",
    "amount_base_units": "50000",
    "refunded_base_units": "50000",
    "remaining_base_units": "50000",
    "receipt_id": "rcpt_01jd2x3k4m5n6p7q8r9s0t1v2w"
  },
  "dispute": {
    "id": "id_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "org_id": "org_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "receipt_id": "rcpt_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "intent_id": "pi_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "merchant_id": "mch_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "merchant_name": "string",
    "merchant_tier": "VERIFIED",
    "reason": "not_delivered",
    "description": "Example",
    "status": "active",
    "resolution": "string",
    "merchant_response": "string",
    "amount_base_units": "50000",
    "amount_display": "string"
  }
}
```
