Customer tokens enable the Acquiring Partner to charge a customer's saved payment method for subscriptions, recurring payments, and one-click checkout without requiring the customer to re-authorize each transaction.
A customer token is a unique, secure identifier issued by Klarna that represents a customer's saved payment method and their consent to be charged. Unlike traditional payment tokens that simply represent card credentials, a Klarna customer token encompasses the customer's relationship with Klarna, including credit evaluation, payment preferences, and authorization scope.
Key characteristics:
When to use customer tokens:
See the Payment Tokenization deep-dive article for detailed information on tokenization flows and best practices.
Customer tokens have a simple structure with core properties and metadata.
| Property | Type | Description | Example |
|---|---|---|---|
customer_token | string | Unique opaque identifier for the customer token. Treat this as an opaque string. Use this in the Klarna-Customer-Token header when authorizing payment transactions. | krn:customer-token:eu1:<customer-token-id> |
scopes | array of strings | Authorization scopes defining when the token can be used. Contains either payment:customer_present or payment:customer_not_present. | ["payment:customer_not_present"] |
customer_token_reference | string (optional) | The Acquiring Partner's internal identifier for the token. Use this to reconcile tokens with the Acquiring Partner's customer records. | "subscription-user-12345" |
The customer_token_response is returned as part of the authorizePayment response when the payment request reaches the
COMPLETED state and request_customer_token was included in the request.
{
"customer_token_response": {
"result": "APPROVED",
"customer_token": {
"customer_token": "krn:customer-token:eu1:a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"customer_token_reference": "subscription-user-12345",
"scopes": ["payment:customer_not_present"]
}
}
}Token scopes determine when and how a customer token can be used. If the Acquiring Partner attempts to authorize a payment transaction with a scope that does not match the token, the authorization is declined.
| Scope | Usage Pattern | Customer Presence Required | Step-up Possible | Use Cases |
|---|---|---|---|---|
payment:customer_present | Customer-initiated | Yes – the customer actively approves each transaction | Yes – Klarna may require verification | On-demand services, wallet payments, one-click checkout |
payment:customer_not_present | Partner-initiated | No – the Acquiring Partner charges without customer interaction | No – the customer cannot complete verification | Subscriptions, recurring charges, scheduled payments |
Scope selection guidelines:
Choose payment:customer_present when:
Choose payment:customer_not_present when:
Selecting the wrong scope can lead to authorization failures. See Payment Tokenization for detailed guidance.
Customer tokens are created during payment authorization by including request_customer_token in the authorizePayment request. Tokenization must occur when the customer is actively present and can provide consent.
Tokenization can be performed in two ways:
For detailed tokenization flows, requirements, and complete code examples, see the Payment Tokenization article.
Once created, customer tokens are used to authorize payment transactions by including the token in the Klarna-Customer-Token header when calling authorizePayment.
The authorization pattern depends on the token scope:
payment:customer_present): Used for on-demand purchases where the customer actively initiates each transaction. Include step_up_config to allow step-up authentication if needed.payment:customer_not_present): Used for automatic recurring charges like subscription renewals. Never include step_up_config as the customer is not present.For detailed authorization patterns, flows, best practices, and complete code examples, see the Payment Tokenization article.
Customer tokens have a simple two-state lifecycle:
| State | Description | Can Authorize Payment Transactions | Actions Available |
|---|---|---|---|
ACTIVE | Token is valid and ready for use. Remains in this state indefinitely unless revoked. | Yes | Authorize payment transactions, revoke token |
REVOKED | Token has been canceled by the customer or the Acquiring Partner. Cannot be reactivated. This is a final state. | No | None (final state) |
Tokens can be revoked through:
Token expiration:
Customer tokens do not expire. Once created, they remain valid until explicitly revoked by the customer, the Acquiring Partner, or Klarna. Store tokens securely and use them as long as customer consent remains valid.
Security best practices:
customer_token securelyWhat to store:
customer_token: Required for authorizationscustomer_token_reference: The Acquiring Partner's internal identifierscopes: To validate usage patternsrequest_customer_token is included) and authorizes payment transactions (when customer token is provided in header)Related articles
API & SDK references