Klarna Docs - Update merchant references

Update merchant references

Use the Order management API to update the order ID (merchant references).

When you want to use your own order ID or make any change to the order ID we provide, you have to send an API call to update the merchant references.

A merchant reference is the order number you assign to the order in your system, different from the default one we provide when creating the order. Your customers can use the merchant reference identifier to inquire about the purchase they made in your store.

When you update the merchant reference, we don't create a new Klarna order_id. The merchant reference is the order_id from your system.

To update the merchant references, send the updated references in a PATCH request to the {apiUrl}/ordermanagement/v1/orders/{order_id}/merchant-references.

The order_id is the identifier you get in a successful response when placing a new order.

JSON
{
    "merchant_reference1": "15632423",
    "merchant_reference2": "special order"
}

Sample request to update merchant references.

You can update one or both references (merchant_reference1 and merchant_reference2). You can also clear a reference by setting its value to "" (empty string). You can use either one or both merchant references. The parameter merchant_reference1 is the order id from your system.

If the request is successful, the merchant reference is updated, and you'll receive a 204 No content response.

If your request contains errors, you'll receive an error response. 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.

JSON
{
  "error_code": "NO_SUCH_ORDER",
  "error_messages": [
    "Order cannot be found. Merchant references cannot be updated."
  ],
  "correlation_id": "17c50e6c-c79d-4174-9369-4b58bca2d2ab"
}

Sample of an error response to update merchant references.

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