Remove an item from an order and refund its full cost.
- Credential
- An API key in
x-api-key - Scopes
orders:write
Parameters
idpath · stringrequiredThe order's
order_id, or itsportal_order_id(ord_…): either resolves the same order. An id the order answered to before it was re-routed resolves too.itemIdpath · stringrequiredItem ID
Idempotency-Keyheader · string (uuid)Unique key for idempotent requests. If you retry a request with the same key within 24 hours, you receive the original response. The key is bound to the request payload: reusing it for a different payload returns 422
idempotency_key_reuserather than the original response, so a changed request is never silently dropped. The binding is over the JSON's content, not its bytes — keys in another order or other whitespace are the same request. Generate a new key for each new request. On an operation that moves money (an order, a batch, an item, a shipping or address change, a cancellation's refund), a key that cannot be checked because the idempotency ledger is unreachable is answered 503idempotency_unavailablewithRetry-After, and nothing runs or is charged: retry with the same key.
Request
DELETE /api/v1/{id}/item/{itemId}/cancel
curl -X DELETE "https://printedsimply.com/api/v1/test_ord_wVK9ZiG-VYiPrlSeBUBmrUVk/item/itm_fowT5-1iZwSnQcGX0ByoA64l/cancel" \
-H "x-api-key: ps_test_YOUR_KEY" \
-H "Idempotency-Key: cancel-item-$(date +%s)"Response 200
Item removed and refunded
data
item_idstringrequiredtest_modebooleanTrue when the order is a sandbox order.
refundedstringrequiredrefunded_centsintegerrequired
meta
pageintegertotalintegerlimitintegerThe page size actually applied, which is not necessarily the one asked for — the operation's own ceiling wins.
pagesintegertotaloverlimit, rounded up.next_cursorstring | nullOn a cursor-paged operation: send this back as
cursorfor the next page. Null on the last page. Absent on operations that do not page by cursor.has_morebooleanOn a list operation whose
metaisListMeta: whether another page follows this one.
{
"status": "success",
"data": {
"item_id": "itm_vNx36IWd8kx2dCQqkFbsTVg3",
"refunded": "$0.00",
"refunded_cents": 0,
"test_mode": true
},
"request_id": "4e3753e1-48dd-4313-bfd8-48e4af4e116a"
}Errors
Missing, invalid or expired API key:
missing_api_key(none sent),invalid_api_key(unknown or revoked),key_expired(past the expiry set when it was created; create a new key).404Resource not found
order_not_modifiable — the order has gone into production (or later), past the point where items can be removed. concurrent_modification — another change to this order's lines (a quantity change, a cancel, an added line) did not finish within a few seconds, or, on a test order (which the plant never sees), changed this line while it ran: nothing was removed or refunded. Read the order and retry.
below_cost_floor — on our own plant, the order this cancel would leave costs more to make and ship than it was charged, at worst-case postage on today's season (one 8×10 or 9×11 poster alone in the carriers' peak window, which checkout refuses too). Nothing was cancelled or refunded;
details.skusnames the lines that would be left anddetails.contribution_centshow far short they fall. Cancel the whole order instead (DELETE /v1/order/{id}/cancel).Rate limit exceeded. Two windows can produce this status and
error.codesays which:rate_limit_exceededfor the per-minute sliding window,daily_quota_exceededfor the plan's daily quota. Both carryRetry-After; the daily one also carriesX-Daily-LimitandX-Daily-Remaining. The per-minute limits are plan-based — see Rate Limits above, or call GET /v1/me for this credential's own figures.refund_failed — the item was removed at the plant and from the order, but its refund went through only in part or not at all (
details.refunded_centsofdetails.owed_cents); the rest is retried automatically. Do not retry the cancellation. settlement_recording_failed — the item was removed at the plant and its refund, if any, was sent, but the order's record could not follow it (among the reasons, another change landed on this line while the cancel ran, and the line was not removed over it): do not retry; read the order and quote the request_id to support.not_supported_by_provider — the order was produced by an independent network shop, which does not accept amendments at all. Never retryable, unlike the 409.
502Production system error
order_lock_unavailable — changes to one order's lines are taken one at a time, and whether another was in progress could not be checked, so nothing was changed, charged or refunded and the production system was not asked; retry the same request after
Retry-After. Sent with or without anIdempotency-Key. idempotency_unavailable — the request carried anIdempotency-Keyand the ledger that makes it mean at-most-once could not be reached, so nothing ran and nothing was charged; retry the same request with the same key afterRetry-After.