Cancels a confirmed order and, when refundAmountMinor is greater than zero,
issues a refund against the order’s payments. Preview the financial impact with
GetOrderCancellationImpact first. Amounts are integer minor currency units.
expectedVersion is the version the caller last observed; a mismatch is rejected
(optimistic concurrency). When a refund is requested, refundRequestId must be a
UUID and makes the refund leg idempotent — reusing it returns the original
refund rather than issuing a second one. The cancellation itself is a state
transition; re-cancelling an order that is not in a cancellable state fails.
Generated Reference
POST/public-api/publicapi.v1.Order/CancelOrder
Cancels an order and optionally issues a refund up to the refundable amount. Guarded by expected_version; the refund leg is idempotent per refund_request_id.
RequestCancelOrderRequest
ResponseCancelOrderResponse
CancelOrderRequest
Field
Type
Description
order_id
string
Stable identifier of the order to cancel.
reason
string
Human-readable cancellation reason.
expected_version
int32
Version the caller last observed, for optimistic concurrency.
refund_amount_minor
optional int64
Amount to refund in minor currency units. Zero or omitted issues no refund.
refund_request_id
string
Idempotency key for the refund leg. Required when refund_amount_minor > 0.
CancelOrderResponse
Field
Type
Description
order
Order
The order after cancellation.
refunds
repeated OrderCancellationRefund
Refunds issued as part of the cancellation, including any that failed.