Using and placing orders with Klarna customer tokens
The Klarna Customer Token let's you store customers on file, making it possible for you to use Klarna's payment methods for e.g. subscriptions. In this article, it will described how to charge, update and read Klarna customer tokens.
Getting it to work
As a merchant, you can get Klarna to do three things with created customer tokens:
- Place new orders from a customer token.
- Update the status of a customer token.
- Read payment details from a customer token
Placing new orders from a customer token
The customer token already contains all customer details and payment method details to place an order. The only thing that you will have to do to place an order using an already created token is thus to create a cart and use that to place an order using the desired token.
From Klarna’s side a risk and fraud assessment is being done when you attempt to place an order using a token. This is to ensure that we can offer the consumer of the customer token the credit necessary for the specific cart and order.
You are responsible for setting the logic of when new orders should be created using customer tokens. In case you, for example, are using customer tokens to charge your customers for recurring purchases, such as subscription fees, you could have a schedule for triggering the right purchases. In case you are using tokens to store payment methods in your online checkout, you must track the consumer and charge the right token accordingly.
When your implemented logic for placing an order using a token is triggered, you should use the create_customer_token_order call. Please ensure that you refer to the right customer token ID when this is done, together with the cart for the order you want to place.
Klarna will respond with a reason for why an order was rejected. Depending on this reason you should act differently. Please ensure that you handle the following responses:
- If technical issue - try again.
- If rejection without reason - will not work a second time.
- If card input issues - you can offer a way for the consumer to re-enter their details according to the previously used .
Updating the status of a customer token
All customer tokens have a status that is either
suspended. When a token is created, it is automatically set to ‘active’. To get more information about the full life cycle of a token and when the statuses are applied, please read .
As a merchant, you can decide to cancel a Klarna customer token if you do not intend to use it anymore – e.g. if the customer has revoked a subscription. This is achieved by changing the status of the customer token to ‘cancelled’. This will make it unusable for future order placements.
Reading payment details from a customer token
All customer tokens have information about the customer and payment method details. Customer data will not be shared when reading a token, but if you want to get information about the payment method details on a token, you may read it.
This will return payment method details, such as expiry date and obfuscated card details, which you may display to a consumer on your subscription page. You can use the read-call on the customer token, which is described in detail .
What logic do you need on your end?
- Be able to securely store the tokens.
- Be able to correctly map your customer to our customer token ID.
- Have logic on your side that tells you when to trigger purchases from a token.