Cancel an order
POST/v3/session/:sessionId/order/cancel
Cancel an order of a payment session. It is only possible to cancel an order that has order status order_approved_not_captured. If the order has been captured it is no longer possible to cancel the order as it should be refunded instead. It is also not possible to cancel a pending or rejected order.
Most payment providers confirm a cancellation right away and you get a 204. A few process it in the background and answer 202 with status: cancel_pending instead. In that case the order sits in order_cancel_pending and the authorization stays live until the provider replies. You then get an order_status webhook with one of:
order_cancelled- the cancellation went through. An authorization that had already expired ends up here too, since it can no longer be captured. Look attransaction.statusto tell them apart:cancelledorexpired.order_approved_not_captured- the provider refused the cancellation. The order is back where it was and can still be captured.
Request
Responses
- 202
- 204
- 400
- 403
- 404
The cancellation is accepted but not confirmed yet. The order is now order_cancel_pending and the authorization stays live until the provider replies. Wait for the order_status webhook - see the endpoint description for the outcomes.
The order is cancelled. The payment provider confirmed it right away, so there is no webhook to wait for.