Orders

Refund order payment

Refund a paid order via Stripe, in full or in part. Requires write access. The customer is refunded first, then the platform fee is adjusted for the refunded amount. Errors: 403 when refunds are not enabled for your workspace — contact support to turn them on. 404 when the order does not exist, and when the endpoint is not available to you. 400 when the order exists but cannot be refunded: it was paid through a processor that doesn't support refunds through this API, its status does not allow a refund, or the amount is above what is still refundable. The 400 message says which. Refunds on a workspace can also be temporarily limited while earlier ones finish settling; that is a 400 telling you to try again later, and it clears on its own. A disputed charge is checked against Stripe live, at request time. If that lookup fails, you get a 503, not a 400 — retry the request; this is not a rejection. Idempotency: send a stable `idempotencyKey` on every retry. Retries carrying the same key are deduplicated. A refund sent without a key is not guaranteed to be deduplicated, so retrying one after a lost response can refund the customer again. Retrying a non-exhausting partial refund with the same `idempotencyKey` returns the original refund and changes nothing else — no second refund, no status change, no notification. If that same key repeats a request a fresh eligibility check now rejects — a full refund, an exhausting partial, or one above the currently refundable amount — you get a 400. Retry with a smaller amount, or contact support to confirm the original refund's status.

Authorization

Public key Secret key
x-fngs-public-key<token>

In: header

x-fngs-secret-key<token>

In: header

Path Parameters

orderIdOrNumber*|

Order identifier - either the order UUID or the order number as returned in 'number' (e.g., L8VQK3N2M7KpQ9nR). This endpoint also accepts the number with the leading '#' the dashboard shows; subscription endpoints do not, so prefer sending it without.

Request Body

application/json

PATCH /v0/orders/:orderIdOrNumber/refund Request body

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

PATCH
/v0/orders/{orderIdOrNumber}/refund
curl -X PATCH "https://example.com/v0/orders/550e8400-e29b-41d4-a716-446655440000/refund" \  -H "Content-Type: application/json" \  -d '{}'
{  "status": "success",  "data": {    "refundId": "string",    "orderId": "b3e1eced-f2bd-4d8c-9765-fbc9d1d222d5",    "amount": 1,    "currency": "AFN",    "status": "succeeded",    "createdAt": "string",    "replayed": true  }}

Cancel order PATCH

Cancel a specific order by changing its status to CANCELLED. This action does not automatically process refunds. To refund a paid order, use the refund endpoint or process through your payment provider. Requires write access.

Get a download URL for an order item POST

Create a time-limited download URL for one digital-download item on a paid order. Requires write access. Use it to re-deliver a file a buyer lost, or to serve the download from your own app or support desk. The buyer does not have to have opened their redeem link first. The item id is the `id` of the entry in `items` on the order's webhook payload. The URL stops working after `expiresIn` seconds — 15 minutes by default, 24 hours at most. Ask for the shortest window your flow can live with: anyone holding the URL can download the file until it expires. For a link a buyer can keep, send them the redeem link from their confirmation email instead. `validTill` is the latest the URL can work, not a promise that it will: a window measured in hours can end earlier. Mint a URL when you are about to hand it over rather than storing one, and mint a fresh one if the buyer comes back later. `mimeType` is the content type recorded when the file was attached, and is null when none was recorded. Errors: 404 when the order does not exist, when the item is not on that order, and when the item has no digital download — a keyed product delivers a license key instead of a file, so it answers 404 here. 400 when the order was never paid, when it has been fully refunded, when every unit of the item has been refunded, and when `expiresIn` is above 86400 — the ceiling is never applied silently. 429 when a workspace asks for more than 60 of these a minute; retry after a minute.