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

# Refund order

> Refund a fulfilled customer order within 24 hours of fulfillment.

Refunds the payments of a fulfilled order for the authenticated customer. Only the tenders change (`REFUNDED`); the order `status` and `fulfillment_status` stay as they are, so no webhook is sent to the POS.

Only orders that are already fulfilled, and whose `resolved_at` is within the last 24 hours, can be refunded from Storefront. Calling it again answers `200` with the order.

> [!NOTE]
>
> Requires a Storefront API access token from [Token
> exchange](https://firespark.cloud/docs/storefront-api/oauth/exchange/post.md).

In `@fire-spark/storefront`, call `order.refund()`: it checks the order is delivered, voids the device charges and calls this endpoint with `type: "REFUND"`. `order.refundOrder()` still calls it without a body.

> [!WARNING]
>
> Unfulfilled orders cannot be refunded here. Cancel them with [Cancel
> order](https://firespark.cloud/docs/storefront-api/orders/\[id]/cancel/post) before fulfillment.

## Path parameters

| Parameter | Required | Description |
| - | - | - |
| `id` | Yes | External order identifier |

## Request body

Optional, same fields as [Cancel order](https://firespark.cloud/docs/storefront-api/orders/\[id]/cancel/post). `type` can only be `REFUND`. A reported `REVERSED` tender ends `REFUNDED`.

## Request

```bash theme={null}
curl -X POST "https://firespark.cloud/api/storefront/v1/orders/ord-48291/refund" \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "type": "REFUND" }'
```

## Response

Returns `200` with the order and its refunded tenders.

```json Success theme={null}
{
  "data": {
    "id": "ord-48291",
    "status": "COMPLETED",
    "fulfillment_status": "FULFILLED",
    "payment_status": "REFUNDED"
  }
}
```

## Error responses

| Status | Description |
| - | - |
| `400` | Malformed body or unknown `type` |
| `401` | Missing or invalid access token, or `device` with a bad secret or not linked |
| `403` | `device` of another workspace (`DEVICE_SCOPE_MISMATCH`) |
| `404` | Order not found |
| `422` | Order is not fulfilled (`ORDER_NOT_FULFILLED`), the 24-hour window expired (`REFUND_WINDOW_EXPIRED`), the order cannot be refunded, `type` is not `REFUND` (`TYPE_ENDPOINT_MISMATCH`), or a reported tender is unknown |


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