Klarna Docs - Place order from Klarna customer token

Place order from Klarna customer token

If you want to charge a customer using a Klarna customer token, you must place an order as described below.

The Klarna customer token created previously can be used to charge the customer at any time. The customer is charged by creating an order using the customer token. This is done by calling the customer token API with the customer token ID and data of order to be created.

Additionally, order lines containing recurring subscription items are required to include the subscription object.  You can read more in our in-depth article on sharing subscription details with Klarna.  

The order can be automatically captured at the time of creation by setting the auto_capture flag to true (default is false).

Note: You must use the correct token ID when placing an order, to ensure that the right consumer gets billed.

POST /customer-token/v1/tokens/{customerToken}/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json

    "merchant_reference1": "45aa52f387871e3a210645d4",
    "merchant_data": "optional string",
    "locale": "de-DE",
    "auto_capture": true,
    "purchase_currency": "EUR",

See the following example for placing an order from a customer token

    "order_id": "a89ec121-1276-419d-882a-c343d58fd1bc",
    "fraud_status": "ACCEPTED"
    "error_code" : "ERROR_CODE",
    "error_messages" : ["Array of error messages"],
    "correlation_id" : "Unique id for this request used for troubleshooting."
Error CodeHTTP status codeComment
TOKEN_NOT_FOUND404The customer token ID used to trigger order placement could not be found.
TOKEN_SUSPENDED403The purchase token has been suspended by Klarna.
TOKEN_CANCELLED403The purchase token has been cancelled by you.
TOKEN_FORBIDDEN403Customer token usage forbidden, e.g. by this merchant ID.
UNAVAILABLE_PAYMENT_METHOD403Payment method type is not available, e.g. card token has failed
PAYMENT_METHOD_CURRENCY_MISMATCH403The payment method of the token is not available for the currency of the order.
PAYMENT_METHOD_FAILED403Purchase for payment method failed. If a credit payment method was used, most likely due to the consumer being rejected. You can try again for PAYMENT_METHOD_FAILED errors.
BAD_REQUEST400The purchase token has been cancelled by you.
INTERNAL_SERVER_ERROR500Internal server error. You can wait and try again soon.
SERVICE_UNAVAILABLE503Purchase failed because of a temporary internal Klarna error. You can try again for a 503.