Implement Payment Presentation caching for server-side integrations where you forward presentation data to Partners. This guide shows how to cache Klarna Payment Presentation variants for non-personalized flows, minimizing dependencies on third-party API calls during checkout.
As an Acquiring Partner, you can optimize checkout performance by caching Klarna Payment Presentation data. The Payment Presentation Variant API provides pre-defined presentation variants based on specific currency, locale, and intent combinations. This allows you to render Klarna payment methods without making real-time API calls on every checkout page load.
The API uses a lazy loading approach: you request a variant for a specific parameter combination when needed and cache the response for subsequent checkouts with the same parameters.
Caching Payment Presentation data delivers several benefits:
Reduced latency during critical checkout moments
Fewer dependencies on external services during payment creation
Improved infrastructure costs and resilience
Better customer experience with faster page loads
Presentation data is solely determined by transaction context (partner account, amount, currency, locale, intent) rather than customer identity.
The API is optimized for lazy loading. This means variants are not pre-fetched or loaded in bulk. Instead, the first checkout that uses a particular currency, locale, and intent combination triggers a call to the Variant API. The response is then cached so that all subsequent checkouts with the same parameters are served from cache without an API call.
Use the Payment Presentation Variant API for non-personalized checkout flows where:
No Customer Token is present (customer is not authenticated)
No Klarna Network Session Token is available (no active Klarna session)
The caching integration follows this high-level flow using a lazy loading strategy. This flow applies whether you render a hosted checkout yourself or return cached presentation data to Partners through your API:
1.
At checkout, generate cache key from specific currency/locale/intent combination
2.
Check cache for presentation variant matching the parameters
3.
On cache miss: request presentation variant from Klarna API for the specific combination
4.
Store variant in cache with TTL from Cache-Control header (currently 4 hours)
5.
Select appropriate payment method based on transaction amount
6.
Refresh cached data on cache expiration or cache miss
sequenceDiagram
participant Checkout as Checkout Page<br/>(Hosted or Server-Side)
participant AP as Acquiring Partner Backend
participant C as Cache Layer
participant K as Klarna Variant API
Note over Checkout,AP: Customer checkout flow
Checkout->>AP: Request Klarna presentation
Note over Checkout,AP: amount, currency, locale, intent
AP->>C: Lookup cached variants
alt Cache miss
AP->>K: Query Variant API
K->>AP: Return variants
AP->>C: Update cache
else Cache hit
C->>AP: Return cached variants
end
Note over AP: Select variant by parameters
Note over AP: Select option by amount
AP->>Checkout: Return Klarna presentation data
Primary payment intent. Possible values: PAY, SUBSCRIBE. When multiple intents are present in a flow, specify the primary intent you want to promote.
acquiring_config[payment_account_id]
string
Conditional
Klarna-assigned Payment Account identifier. Required for multi-payment-account configurations. Use this parameter alone or use the combination of acquiring_config[payment_acquiring_account_id] and acquiring_config[payment_account_reference] — not both.
acquiring_config[payment_acquiring_account_id]
string
Conditional
Acquiring account identifier. Required for multi-payment-account configurations. Must be provided together with acquiring_config[payment_account_reference].
acquiring_config[payment_account_reference]
string
Conditional
Unique string reference to identify the Payment Account. Required for multi-payment-account configurations. Must be provided together with acquiring_config[payment_acquiring_account_id].
Acquiring configuration for multi-payment-account Partners
If you are an Acquiring Partner with multiple Payment Accounts, include the acquiring_config query parameter to specify which Payment Account to use. For Partners with a single Payment Account, omitting acquiring_config is allowed — Klarna automatically uses the only available Payment Account.
Provide one of the following combinations — not both:
Fetch Payment Presentation Variant on demand when the requested parameter combination is not available in cache. The API accepts one specific combination of currency, locale, and intent per request.
The response contains the following top-level fields:
Field
Type
Description
applicable_parameters
object
Parameter combination for which this variant applies
applicable_parameters.intent
string
Payment intent (PAY, SUBSCRIBE)
applicable_parameters.locale
string
BCP 47 language tag
applicable_parameters.currency
string
ISO 4217 currency code
applicable_parameters.payment_account_id
string
Payment Account ID (if applicable)
applicable_parameters.payment_account_reference
string
Payment Account Reference (if applicable)
payment_presentation_variant_id
string
Unique identifier for this variant (only present when instruction is SHOW_KLARNA)
instruction
string
Display instruction: SHOW_KLARNA, HIDE_KLARNA
ranged_payment_options
array
Amount-based presentation options (only present when instruction is SHOW_KLARNA)
Always honor the instruction field from the response:
SHOW_KLARNA: Display Klarna as a payment option. Response includes payment_presentation_variant_id and ranged_payment_options
HIDE_KLARNA: Do not present Klarna, this instruction means that Klarna is not available for the combination of provided parameters. Response does NOT include payment_presentation_variant_id or ranged_payment_options
When the instruction is SHOW_KLARNA, the response includes ranged_payment_options with amount-based presentation data.
Klarna returns HIDE_KLARNA when the requested combination of currency, locale, or intent is not supported for the given Partner Account. In this case, do not display Klarna as a payment option for that parameter combination.
At checkout time, look up the cached variant for the current parameter combination. If a cached variant exists, use it to render the payment method (see Step 4). If the cache has no entry for the requested parameters, fall back to a live API call (Step 1) and store the result (Step 2).
When a variant is available (from cache or from a fresh API response), render it based on the instruction field:
1.
HIDE_KLARNA -- Do not display Klarna in the payment selector for this parameter combination.
2.
SHOW_KLARNA -- Find the matching range in ranged_payment_options where the transaction amount falls between minimum_amount (inclusive) and maximum_amount (exclusive). Use the payment_option fields (header, subheader, icon, payment button, message) from that range to render Klarna in your payment selector.
Problem: Cache storage grows too large with many parameter combinations or Payment Accounts
Solution: Implement two-level cache using variant IDs
Instead of storing the complete response for every parameter combination, split the storage into two cache collections. This enables deduplication when multiple parameter combinations share the same variant definitions (identified by payment_presentation_variant_id).
Storage architecture:
1.
Store parameter-to-variant-ID mappings indexed by cache key (parameter combination)
2.
Store variant data (ranged_payment_options) indexed by payment_presentation_variant_id
3.
Reference variant data by ID rather than duplicating the full ranged options
4.
Share variant definitions across multiple parameter combinations
If your Partners build their own payment selector, return the cached presentation data through your Partner-facing API so they can render Klarna themselves.
If you render the payment selector yourself, use the cached presentation data together with the Klarna Web SDK to display Klarna in your hosted checkout.