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. An order whose payment cannot be refunded through this API is also a 400; contact support to refund it. 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 In: header
In: header
Path Parameters
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
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 an order that is still waiting for payment, so the buyer can no longer pay for it. Only orders with status PENDING can be cancelled. Any other status (including PAID, REFUNDED, PARTIALLY_REFUNDED and FAILED) returns 400. To give a buyer their money back for a paid order, use the refund endpoint instead. Cancelling an order that is already CANCELLED returns it unchanged. If the order has a payment in progress, its payment is cancelled first, and the order is marked CANCELLED only once that succeeds. If the payment can no longer be cancelled (for example, the buyer has just paid), the endpoint returns 400 and the order is left as it was. Only Stripe payments can be cancelled this way. A 503 means the payment service could not be reached, and a 409 that the payment changed while the order was being cancelled; both are safe to retry. 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.