Creating a Klarna Customer Token results in Klarna storing customer and payment method details. You can later used the token_id shared with you to trigger purchases for the Klarna customer token.
After having obtained an authorization_token for a successful authorization, this can be used to create a purchase token instead of placing the order.
Since a purchase token has no order lines and amount connected to it, there is no need to charge the customer at this point. Instead the purchase token will be used to charge consumer at a later stage, which can be read in a separate article.
The response will contain a redirect URL to which the user should be redirected. The user will bounce through Klarna and be redirected to the confirmation URL provided in the API calls.
Example successful response
If there is an error with the request, the response will follow the standard error-format of Klarna. Below is a description of the most common error reasons.
Below are the most common error codes and what they mean.
|Error Code||Error messages||Comment|
|NOT_FOUND||Invalid authorization token||This is returned if order is placed after the authorization token has expired. Please ensure the order is placed within 60 minutes of the authorization.|
|BAD_VALUE||Bad value: purchase_country||The country of the billing address is different from that of the purchase_country of the session. Causing a mismatch|
|BAD_REQUEST||X is not valid for creating customer tokens in Y||The payment method X is not available for tokenization in country Y.|