Orders

Cancel order

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.

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/cancel Request body

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

PATCH
/v0/orders/{orderIdOrNumber}/cancel
curl -X PATCH "https://example.com/v0/orders/550e8400-e29b-41d4-a716-446655440000/cancel" \  -H "Content-Type: application/json" \  -d '{}'
{  "status": "success",  "data": {    "order": {      "object": "order",      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "number": "string",      "status": "PENDING",      "value": 0,      "tax": 0,      "fee": 0,      "totalItems": 0,      "country": null,      "currency": "AFN",      "currencyDecimals": null,      "createdAt": 0,      "userId": null,      "user": null,      "lastPaymentId": null,      "lastPaymentNumber": null,      "lastPayment": null,      "subscriptionId": null,      "subscription": null,      "checkoutId": null,      "orderNumber": "string"    }  }}

Update order PATCH

Modify an existing order's details. Can update status, value, fee, tax, and currency. Requires write access. Note: Use with caution as this directly modifies order records. For most cases, use the refund or cancel endpoints instead. A store that has moved to the new platform answers 409: its orders follow their payments there.

Refund order payment PATCH

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.