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 Code | HTTP status code | Comment |
---|---|---|
TOKEN_NOT_FOUND | 404 | The customer token ID used to trigger order placement could not be found. |
TOKEN_SUSPENDED | 403 | The purchase token has been suspended by Klarna. |
TOKEN_CANCELLED | 403 | The purchase token has been cancelled by you. |
TOKEN_FORBIDDEN | 403 | Customer token usage forbidden, e.g. by this merchant ID. |
UNAVAILABLE_PAYMENT_METHOD | 403 | Payment method type is not available, e.g. card token has failed |
PAYMENT_METHOD_CURRENCY_MISMATCH | 403 | The payment method of the token is not available for the currency of the order. |
PAYMENT_METHOD_FAILED | 403 | Purchase 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_REQUEST | 400 | The purchase token has been cancelled by you. |
INTERNAL_SERVER_ERROR | 500 | Internal server error. You can wait and try again soon. |
SERVICE_UNAVAILABLE | 503 | Purchase failed because of a temporary internal Klarna error. You can try again for a 503. |