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

# Refund Order

> Requests a refund for an order.

#### Scope

```bash theme={null}
write orders
```

## What it does

Requests a refund for an order. Responds with `202` and an `approval_id`; the refund only occurs after you approve it in DoglyTdc Pay.

## Use cases

* Refund requested by the buyer
* Cancel a duplicate sale

**id** `string\<uuid\>` *required*

Order ID.

## Response

**status** `string`

Always `approval_required`.

**approval\_id** `string\<uuid\>`

Pending approval ID.

**expires\_at** `string\<date-time\>`

Approval deadline.

## Errors

| Status | Description |
| - | - |
| `401` | Invalid or revoked key. |
| `403` | Missing scopes (`insufficient_scope`). |
| `429` | Rate limit exceeded (`rate_limited`). |

```bash cURL theme={null}
curl --request POST \
  --url https://ucsyxzpdbnuyehizezvb.supabase.co/functions/v1/doglytdc-pay/v1/orders/5b1e9c3a-7d2f-4e8a-b6c4-0a1b2c3d4e5f/refund \
  -u "$DPAY_CLIENT_ID:$DPAY_CLIENT_SECRET"
```

```json 202 theme={null}
{
  "status": "approval_required",
  "approval_id": "0e9d8c7b-6a5f-4e3d-9c2b-1a0f9e8d7c6b",
  "expires_at": "2026-11-06T18:40:00Z",
  "message": "Autorize no DoglyTdc Pay › Integrações › MCP."
}
```

```json 401 theme={null}
{ "error": "unauthorized", "message": "Chave de API inválida." }
```

```json 403 theme={null}
{ "error": "insufficient_scope", "message": "Esta chave precisa dos escopos: write, orders." }
```


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