Palbase Commerce & Promotions · API
/commerce/stores/{store_id}/orders/{store_order_id}/cancelCancel full or partial seller store order
Cancel what of a store's order was not sent yet — all of it, or the items named. What the buyer paid for the canceled units goes back as the cancellation is made, the way the order was paid, and the shipping with it when nothing of the order is left and none of it was sent: refund_amount is what was given back (0 for an order not paid). It is held to what was paid for the order, less what its returns and earlier cancellations gave back. When the refund is refused the units are not canceled, and the answer says why. When payments cannot say yet whether it was made, the units stay canceled and the cancellation waits: the same request sent again (the same Idempotency-Key, or the same body when neither carries one) settles it, or Palbase does, and the money goes back once; another cancellation of the order meanwhile is 409 cancellation_in_progress. Send an Idempotency-Key: under it a request is one cancellation however often it is sent, and a request under another key is another. An order whose payment is still being asked for answers 409 order_being_placed. Canceled units go back in stock, and what an unpaid order held of them is let go; units that are not there to sell are kept out of it with restock: false, for the request or for one of its items. An order canceled whole before it was paid is canceled and its payment is closed; an order canceled in part and then paid whole, or paid all the same, gives its buyer the canceled units' price back by itself. All of an order canceled again answers the cancellation that was made (200). A cancellation is named by cancellation_id, alone in the body with one of two words, and nothing is canceled by it. retry: true asks payments for its money now: one waiting for it (one payments refused is the project's to ask again, as its being given outside is: 403 refund_retry_forbidden here) — answered 200 once payments gives it, with payments' own code and 409 when payments refuses it again, and 409 refund_pending or 502 provider_unavailable when payments cannot say yet (Palbase asks again by itself). refunded_outside: true says what it owes its buyer was given back outside the platform, and ends that debt only: of an order paid outside the platform, said by its store or the project; of one paid through it that payments refused to give back, by the project's server or admin alone (403 refund_outside_forbidden for a store's member), and, of a store paid through its payment split, payments is told it was given outside: nothing goes back through the platform, and the seller's share of it is taken back from what the seller is paid — or owed by the seller, once paid or when the payment provider will not lower the seller's payout. Payments not answering it (502), Palbase tells it again by itself until payments does, and meanwhile retry answers 409 cancellation_in_progress; so does the word while the order's split is still being named: ask again. A debt payments has not refused is 409 refund_not_refused; one payments gave, 409 refund_given. A store order's cancellations, what each gives back, where that stands (refund_state: done, pending, owed, outside, refused) and how many times payments was asked for it, are read with it. A refused debt is not asked again by itself. A bundle is canceled by its line, its parts with it (422 bundle_part for a part named alone); an Idempotency-Key sent the same day with other units is 422 idempotency_key_reused. An order given back whole is refunded, the promotions it used are undone by the discount of what went back, and cashback of it not yet the buyer's is no longer earned. A bundle is given back by its parts: the line that names it gives nothing more. A cancellation that gives a paid order's money back emits commerce.order.refunded with its cancellation_id; a line canceled whole loses the entitlement it granted (revoked_entitlements). fault_party is buyer, seller (the default), platform or payment_timeout (400 invalid_fault_party otherwise). An order paid outside the platform — on delivery, by a bank transfer, on credit — is given back outside it: the body says so with refunded_outside: true, and without it the answer is 409 refund_outside_required. Units of a line whose open return asks for the money they would give back are not canceled until the return is completed or turned down (409 line_has_open_return, with every such line's id in order_line_ids); a line named in items that is no line of this store order is 404 order_line_not_found, and a cancellation_id that names no cancellation of it 404 cancellation_not_found; a cancellation gives back no more than its line has left after what its returns gave.
Called by a signed-in user of your app, with their token and the publishable key; or your server, with the project's secret key.
Path
store_idstring · requiredPath parameter store_id.store_order_idstring · requiredPath parameter store_order_id.curl -X POST "https://<your-ref>.palbase.studio/commerce/stores/<store_id>/orders/<store_order_id>/cancel" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{}'Responses
200The cancellation made before, as it stands (`refund_amount` is 0 while it is owed): the same request was made before — under its `Idempotency-Key`, or with no key and not answered yet — or nothing of the order was left to cancel. Or, with `cancellation_id`, that cancellation, said given back outside
201Cancel full or partial seller store order
409Refused: `line_has_open_return` (the lines in `order_line_ids` have open returns that ask for the money their units would give back, or for the order's shipping; nothing canceled); `cancellation_in_progress` (another cancellation of the order waits for its money: ask again; nothing canceled); `order_being_placed` (the order's payment is still being asked for: ask again; nothing canceled); `refund_not_refused` (with `cancellation_id`: payments gives it back by itself); `refund_given` (with `cancellation_id`: payments gave it); `cancellation_in_progress` (with `cancellation_id`: the cancellation is being settled, or its word told to payments: ask again); `refund_outside_required` (an order paid outside the platform, without `refunded_outside: true`); `order_not_paid`; `refund_in_progress` or `refund_pending` (payments cannot say yet whether the refund was made: the units stay canceled; ask again with the same request); `refund_failed` (the provider did not make it); or the code payments refused the refund with (`refund_refused` when it gives none).
defaultStandard Palbase JSON error envelope (`error` and `error_description`).
Operation SellerCancelStoreOrder of commerce's contract.