Klarna Docs - Cancel an order

Cancel an order

Use the Order management API to cancel uncaptured orders.

When your customers don't want to proceed with the purchase and need to cancel their order before you capture it, send an API call to cancel the authorization.

When you cancel the order, we release the authorized amount and you can't make further updates to the order.

To successfully cancel the order, don’t capture any items listed in it.

The following diagram depicts how this API call works:

Sequence diagram of the API call to cancel an order.

To cancel an authorized order, send a POST request to the {apiUrl}/ordermanagement/v1/orders/{order_id}/cancel.

The order_id is the identifier you get in a successful response when placing a new order. You don't need a request body for this POST method.

If the request is successful, the order is canceled, and you'll receive a 204 No content response.

If your request contains errors, you'll receive an error response. It can be because the order has captures or is closed.

JSON
{
  "error_code": "CANCEL_NOT_ALLOWED",
  "error_messages": [
    "Order has previous captures. Cancel not possible."
  ],
  "correlation_id": "95ccbcb1-8963-4569-b721-1a354"
}

Sample of an error response to cancel an order.

Make sure the order_id is correct. You can use the correlation_id and the order_id values to troubleshoot the call in the Merchant portal Logs section.

Ready to send this request? See the API reference of this call.