# Set up future Klarna payments Learn how to save Klarna details and charge your customers later. You can save Klarna as a customer’s *payment method* (PaymentMethods represent your customer's payment instruments, used with the Payment Intents or Setup Intents APIs) and charge future payments to support: - Automatic payment for *subscriptions* (A Subscription represents the product details associated with the plan that your customer subscribes to. Allows you to charge the customer on a recurring basis), with or without a [free trial](https://docs.stripe.com/billing/subscriptions/trials.md). - Automatic payment for subscriptions for orders that also include non-subscription products. - Saving Klarna to a wallet to streamline future *on-demand* (When a customer stores their payment method with a business, they can make on-demand future purchases without re-authenticating, such as ordering a ride in their ride-share app) purchases without requiring customer re-authentication. This guide explains how to save Klarna as a payment method that you can charge immediately or later. This guide isn’t for integrations that use [Stripe Billing](https://docs.stripe.com/billing.md). If you use Stripe Billing, see [Klarna for subscriptions](https://docs.stripe.com/billing/subscriptions/klarna.md). > #### Available Klarna payment options vary by use case and buyer country > > See which [payment options](https://docs.stripe.com/payments/klarna.md#payment-options) are available for your customers before you start your integration. We recommend using [Stripe Checkout](https://docs.stripe.com/payments/checkout.md) to save Klarna as a payment method. # Direct API If you want to create a customized payments UI, use the [Payment Intents API](https://docs.stripe.com/api/payment_intents.md) with [setup_future_usage](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-setup_future_usage) or the [Setup Intents API](https://docs.stripe.com/api/setup_intents.md) to save Klarna payment method details and charge your customers later. ## Set up Stripe [Server-side] [Client-side] Use our official libraries for access to the Stripe API from your application: #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` ## Create or retrieve a Customer before setup [Server-side] To reuse a Klarna payment method for future payments, you must attach it to a *Customer* (Customer objects represent customers of your business. They let you reuse payment methods and give you the ability to track multiple payments). Create a Customer object when your customer creates an account on your business. Associating the ID of the Customer object with your own internal representation of a customer enables you to retrieve and use the stored payment method details later. If your customer hasn’t created an account, you can still create a Customer object now and associate it with your internal representation of the customer’s account later. ```curl curl -X POST https://api.stripe.com/v1/customers \ -u "<>:" ``` ## Create a PaymentIntent or SetupIntent [Server-side] Select the scenario below that best fits your use case. #### Subscription with initial payment If you’re setting up a subscription and charging the initial payment, use the Payment Intents API with [setup_future_usage](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-setup_future_usage). You should pass subscription details when you set up the subscription. Passing in subscription details: - Ensures your customers have access to all applicable [Klarna payment options](https://docs.stripe.com/payments/klarna.md#payment-options), including Pay in 3 or 4, which is only available for subscriptions that have specific lengths. - Reduces support rates and customer dropouts due to unclear purchase details in the Klarna app, where Klarna renders subscription data for your customers. Use the [payment_method_options](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-payment_method_options-klarna) parameter to pass in subscription details. The subscription [reference](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-klarna-subscriptions-reference) is an arbitrary identifier you choose that isn’t visible to customers (for example, `GYM_ANNUAL_MEMBERSHIP` or `ID_123`). > #### Use the same reference to charge the saved payment method > > When you charge the saved payment method, use the same subscription reference. The reference value needs to match the value of the `amount_details[line_items][payment_method_options][klarna][subscription_reference]` field, if you integration uses it later. If you don’t match the value, you receive an error. The example below shows how to pass details for an annual subscription. ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=5000 \ -d currency=usd \ -d customer={{CUSTOMER_ID}} \ -d setup_future_usage=off_session \ -d "amount_details[line_items][0][product_name]=Annual subscription" \ -d "amount_details[line_items][0][quantity]=1" \ -d "amount_details[line_items][0][unit_cost]=5000" \ -d "amount_details[line_items][0][payment_method_options][klarna][subscription_reference]=EXAMPLE_REFERENCE" \ -d "payment_method_options[klarna][subscriptions][0][reference]=EXAMPLE_REFERENCE" \ -d "payment_method_options[klarna][subscriptions][0][interval]=year" ``` The resulting PaymentIntent contains a [client_secret](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-client_secret). Pass the secret to the client side to redirect your buyer to Klarna and authorize the saved payment method. #### Subscription and non-subscription products If you’re charging for a one-off product and setting up a subscription at the same time, use the Payment Intents API with [setup_future_usage](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-setup_future_usage). You should pass subscription details when you set up the subscription. Passing in subscription details: - Ensures your customers have access to all applicable [Klarna payment options](https://docs.stripe.com/payments/klarna.md#payment-options), including Pay in 3 or 4, which is only available for subscriptions that have specific lengths. - Reduces support rates and customer dropouts due to unclear purchase details in the Klarna app, where Klarna renders subscription data for your customers. Use the [payment_method_options](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-payment_method_options-klarna) parameter to pass in subscription details. The subscription [reference](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-klarna-subscriptions-reference) is an arbitrary identifier you choose that isn’t visible to customers (for example, `GYM_ANNUAL_MEMBERSHIP` or `ID_123`). > #### Use the same reference to charge the saved payment method > > When you charge the saved payment method, use the same subscription reference. The reference value needs to match the value of the `amount_details[line_items][payment_method_options][klarna][subscription_reference]` field, if you integration uses it later. If you don’t match the value, you receive an error. The example below shows how to pass details for an annual subscription. ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=100000 \ -d currency=usd \ -d customer={{CUSTOMER_ID}} \ -d setup_future_usage=off_session \ -d "amount_details[line_items][0][product_name]=One-off product" \ -d "amount_details[line_items][0][unit_cost]=5000" \ -d "amount_details[line_items][0][quantity]=1" \ -d "amount_details[line_items][1][product_name]=Annual subscription" \ -d "amount_details[line_items][1][unit_cost]=5000" \ -d "amount_details[line_items][1][quantity]=1" \ -d "amount_details[line_items][1][payment_method_options][klarna][subscription_reference]=EXAMPLE_REFERENCE" \ -d "payment_method_options[klarna][subscriptions][0][reference]=EXAMPLE_REFERENCE" \ -d "payment_method_options[klarna][subscriptions][0][interval]=annual" ``` The resulting PaymentIntent contains a [client_secret](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-client_secret). Pass the secret to the client side to redirect your buyer to Klarna and authorize the saved payment method. #### Subscription with trial If you’re setting up a subscription with a trial period, use the Setup Intents API. You should pass subscription details when you set up the subscription. Passing in subscription details: - Ensures your customers have access to all applicable [Klarna payment options](https://docs.stripe.com/payments/klarna.md#payment-options), including Pay in 3 or 4, which is only available for subscriptions that have specific lengths. - Reduces support rates and customer dropouts due to unclear purchase details in the Klarna app, where Klarna renders subscription data for your customers. Use the [payment_method_options](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-payment_method_options-klarna) parameter to pass in subscription details. The subscription [reference](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-klarna-subscriptions-reference) is an arbitrary identifier you choose that isn’t visible to customers (for example, `GYM_ANNUAL_MEMBERSHIP` or `ID_123`). > #### Use the same reference to charge the saved payment method > > When you charge the saved payment method, use the same subscription reference. The reference value needs to match the value of the `amount_details[line_items][payment_method_options][klarna][subscription_reference]` field, if you integration uses it later. If you don’t match the value, you receive an error. The example below shows how to pass details on an annual subscription. ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d customer={{CUSTOMER_ID}} \ --data-urlencode "return_url=https://example.com/setup/complete" \ -d "payment_method_options[klarna][currency]=usd" \ -d "payment_method_options[klarna][subscriptions][0][reference]=EXAMPLE_REFERENCE" \ -d "payment_method_options[klarna][subscriptions][0][interval]=annual" \ -d "payment_method_options[klarna][subscriptions][0][next_billing][amount]=10000" \ -d "payment_method_options[klarna][subscriptions][0][next_billing][date]=2026-01-01" ``` The resulting SetupIntent contains a [client_secret](https://docs.stripe.com/api/setup_intents/object.md#setup_intent_object-client_secret). Pass the secret to the client side to redirect your buyer to Klarna and authorize the saved payment method. #### On-demand payments For an *on-demand* (When a customer stores their payment method with a business, they can make on-demand future purchases without re-authenticating, such as ordering a ride in their ride-share app) use case, you can use either the Payment Intents API or the Setup Intents API. If you want to process a payment and save the payment method at the same time, use the Payment Intents API. ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=5000 \ -d currency=usd \ -d "customer={{CUSTOMER_ID}}" \ -d setup_future_usage=off_session \ -d "amount_details[line_items][0][product_name]=Your product name" \ -d "amount_details[line_items][0][unit_cost]=5000" \ -d "amount_details[line_items][0][quantity]=1" ``` If you only need to save the payment method for later use and aren’t processing a payment, use the Setup Intents API. ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d usage=on_session ``` ## Redirect your customer [Client-side] When a customer attempts to set up their Klarna account for future payments, use [Stripe.js](https://docs.stripe.com/js.md) to confirm the PaymentIntent or SetupIntent. Stripe.js is our foundational JavaScript library for building payment flows. It automatically handles functions such as the redirect described below, and enables you to extend your integration to other payment methods in the future. ### Set up Stripe.js Include the Stripe.js script on your checkout page by adding it to the head of your HTML file. ```html Checkout ``` Create an instance of Stripe.js with the following JavaScript on your checkout page. ```javascript import {loadStripe} from '@stripe/stripe-js'; const stripe = await loadStripe('<>'); ``` To confirm the setup on the client side, pass the client secret of the PaymentIntent or SetupIntent object that you created in step 3. The client secret is different from your API keys that authenticate Stripe API requests. Handle it carefully because it can complete the charge. Don’t log it, embed it in URLs, or expose it to anyone but the customer. ### Confirm and redirect Stripe.js automatically redirects your customer to Klarna when you confirm the PaymentIntent or SetupIntent. After the customer completes the process, Klarna redirects them back to the `return_url` you specify. #### PaymentIntent Pass the `client_secret` you received when creating your PaymentIntent in step 3. The client secret is different from your API keys that authenticate Stripe API requests. Handle it carefully, because it can complete the payment. Don’t log it, embed it in URLs, or expose it to anyone but the customer. ```javascript // Redirects away from the client const {error} = await stripe.confirmKlarnaPayment( '{{PAYMENT_INTENT_CLIENT_SECRET}}', { payment_method: { billing_details: { email: 'jenny@example.com', address: { country: 'DE' } } }, return_url: 'https://example.com/setup/complete' } ); if (error) { // Inform the customer that there was an error. } ``` #### SetupIntent Pass the `client_secret` you received when creating your SetupIntent in step 3. The client secret is different from your API keys that authenticate Stripe API requests. Handle it carefully, because it can complete the payment. Don’t log it, embed it in URLs, or expose it to anyone but the customer. ```javascript // Redirects away from the client const {error} = await stripe.confirmKlarnaSetup( '{{SETUP_INTENT_CLIENT_SECRET}}', { payment_method: { billing_details: { email: 'jenny@example.com', address: { country: 'DE', }, }, }, return_url: 'https://example.com/setup/complete', mandate_data: { customer_acceptance: { type: 'online', online: { infer_from_client: true } } }, } ); if (error) { // Inform the customer that there was an error. } ``` ## Monitor webhooks [Server-side] Use a method such as [webhooks](https://docs.stripe.com/payments/payment-intents/verifying-status.md#webhooks) to confirm that the customer authorized the billing agreement. Don’t rely on your customer to return to the payment status page. When a customer successfully authorizes the billing agreement, Stripe emits a [payment_intent.succeeded](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.succeeded) or [setup_intent.succeeded](https://docs.stripe.com/api/events/types.md#event_types-setup_intent.succeeded) *webhook* (A webhook is a real-time push notification sent to your application as a JSON payload through HTTPS requests) event and the Intent status transitions to `succeeded`. Store the resulting [payment_method](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-payment_method) ID to make payments using the saved PaymentMethod later. If a customer doesn’t successfully authorize the billing agreement, Stripe emits a [payment_intent.payment_failed](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.payment_failed) or [setup_intent.setup_failed](https://docs.stripe.com/api/events/types.md#event_types-setup_intent.setup_failed) *webhook* (A webhook is a real-time push notification sent to your application as a JSON payload through HTTPS requests) event and the Intent status returns to `requires_payment_method`. ## Charge a saved Klarna payment method [Server-side] #### Subscription renewal When you’re ready to charge your customer off-session, use the *Customer* (Customer objects represent customers of your business. They let you reuse payment methods and give you the ability to track multiple payments) and *PaymentMethod* (PaymentMethods represent your customer's payment instruments, used with the Payment Intents or Setup Intents APIs) IDs to create a [PaymentIntent](https://docs.stripe.com/api/payment_intents.md). Set a few other parameters to make the *off-session payment* (A payment is described as off-session if it occurs without the direct involvement of the customer, using previously-collected payment information): - Set [off_session](https://docs.stripe.com/api/payment_intents/confirm.md#confirm_payment_intent-off_session) to `true` to indicate that the customer isn’t in your checkout flow during this payment attempt, which causes the PaymentIntent to throw an error if authentication is required. - Set the value of the PaymentIntent’s [confirm](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-confirm) property to `true`, which causes confirmation to occur immediately when the PaymentIntent is created. - Set [payment_method](https://docs.stripe.com/api.md#create_payment_intent-payment_method) to the ID of the PaymentMethod and [customer](https://docs.stripe.com/api.md#create_payment_intent-customer) to the ID of the Customer. - Specify a [return_url](https://docs.stripe.com/api/payment_intents/confirm.md#confirm_payment_intent-return_url) to indicate where Stripe needs to redirect the customer after they return from Klarna’s website. Send subscription details and line items with each renewal. Use the same `reference` for your subscription as you did when setting up the payment method. If the subscription details have changed since you saved the payment method, send the new information with the same `reference`. ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=5000 \ -d currency=usd \ -d confirm=true \ -d customer={{CUSTOMER_ID}} \ -d payment_method={{PAYMENT_METHOD_ID}} \ -d off_session=true \ --data-urlencode "return_url=https://example.com/setup/complete" \ -d "amount_details[line_items][0][product_name]=Annual subscription renewal" \ -d "amount_details[line_items][0][quantity]=1" \ -d "amount_details[line_items][0][unit_cost]=5000" \ -d "amount_details[line_items][0][payment_method_options][klarna][subscription_reference]=EXAMPLE_REFERENCE" \ -d "payment_method_options[klarna][subscriptions][0][reference]=EXAMPLE_REFERENCE" \ -d "payment_method_options[klarna][subscriptions][0][interval]=year" ``` #### On-demand payment When you’re ready to charge your customer, use the *Customer* (Customer objects represent customers of your business. They let you reuse payment methods and give you the ability to track multiple payments) and *PaymentMethod* (PaymentMethods represent your customer's payment instruments, used with the Payment Intents or Setup Intents APIs) IDs to create a [PaymentIntent](https://docs.stripe.com/api/payment_intents.md). Set a few other parameters to make the *off-session payment* (A payment is described as off-session if it occurs without the direct involvement of the customer, using previously-collected payment information): - Set [off_session](https://docs.stripe.com/api/payment_intents/confirm.md#confirm_payment_intent-off_session) to `false` to indicate that the customer is in a checkout flow during this payment attempt. If an error occurs, such as one that requires authentication, the customer is redirected to Klarna’s page to authenticate or resolve the issue. - Set the value of the PaymentIntent’s [confirm](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-confirm) property to `true`, which causes confirmation to occur immediately when the PaymentIntent is created. - Set [payment_method](https://docs.stripe.com/api.md#create_payment_intent-payment_method) to the ID of the PaymentMethod and [customer](https://docs.stripe.com/api.md#create_payment_intent-customer) to the ID of the Customer. The example below includes optional details using [payment_method_options](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options) to help improve Klarna underwriting and authorization rates. This includes details on how this saved Klarna payment method should be used in the future, such as expected future order amounts and frequency of payments. ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=1099 \ -d currency=usd \ -d confirm=true \ -d customer={{CUSTOMER_ID}} \ -d payment_method={{PAYMENT_METHOD_ID}} \ -d off_session=false \ --data-urlencode "return_url=https://example.com/setup/complete" \ -d "amount_details[line_items][0][product_name]=Annual subscription" \ -d "amount_details[line_items][0][quantity]=1" \ -d "amount_details[line_items][0][unit_cost]=1099" \ -d "amount_details[line_items][0][payment_method_options][klarna][subscription_reference]={{SUBSCRIPTION_ID}}" \ -d "payment_method_options[klarna][on_demand][average_amount]=1000" \ -d "payment_method_options[klarna][on_demand][minimum_amount]=100" \ -d "payment_method_options[klarna][on_demand][maximum_amount]=10000" \ -d "payment_method_options[klarna][on_demand][interval]=year" \ -d "payment_method_options[klarna][on_demand][interval_count]=1" ``` ## Handle reusable payment method revocation [Server-side] You can revoke a reusable payment method in two ways: - A customer can deactivate a reusable payment method in the Klarna mobile application. In this case, Stripe sends you a [mandate.updated](https://docs.stripe.com/api/events/types.md#event_types-mandate.updated) event. To handle this, subscribe to [webhook](https://docs.stripe.com/webhooks.md) events, and call [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md) to deactivate it. - A customer can also deactivate a reusable payment method on your UI, if supported. In this scenario, your server can call [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md) to handle the deactivation. In both cases, after you call [detach PaymentMethod](https://docs.stripe.com/api/payment_methods/detach.md), Stripe sends you a [payment_method.detached](https://docs.stripe.com/api/events/types.md#event_types-payment_method.detached) event. ## Test your integration When testing your integration in a testing environment, you can simulate different outcomes within Klarna’s redirect. > Klarna uses cookies for session tracking. To test different customer locations, log out of the Klarna sandbox from the previous session and use the relevant triggers. Below, we have specially selected test data for the currently supported customer countries. In a sandbox, Klarna approves or denies a transaction based on the supplied email address. #### Australia | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Date of Birth | 10-07-1970 | 03-05-1994 | | First Name | Test | John | | Last Name | Person-au | snow | | Street | Wharf St | Silverwater Rd | | House number | 4 | 1-5 | | Postal Code | 4877 | 2128 | | City | Port Douglas | Silverwater | | Region | QLD | NSW | | Phone | +61473752244 | +61473763254 | | Email | customer@email.au | customer+denied@email.au | #### Austria | | Approved | Denied | | ------------- | ------------------ | ------------------------ | | Date of Birth | 10-07-1970 | 10-07-1970 | | First Name | Test | Test | | Last Name | Person-at | Person-at | | Email | customer@email.at | customer+denied@email.at | | Street | Mariahilfer Straße | Mariahilfer Straße | | House number | 47 | 47 | | City | Wien | Wien | | Postal code | 1060 | 1060 | | Phone | +4306762600456 | +4306762600745 | #### Belgium | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Date of Birth | 10-07-1970 | 10-07-1970 | | First Name | Test | Test | | Last Name | Person-be | Person-be | | Email | customer@email.be | customer+denied@email.be | | Street | Grote Markt | Grote Markt | | House number | 1 | 1 | | City | Brussel | Brussel | | Postal code | 1000 | 1000 | | Phone | +32485121291 | +32485212123 | #### Canada | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Date of Birth | 10-07-1970 | 10-07-1970 | | First Name | Test | Test | | Last Name | Person-ca | Person-ca | | Street | 2693 Byron Rd | 2693 Byron Rd | | Postal Code | V7H 1L9 | V7H 1L9 | | City | North Vancouver | North Vancouver | | Region | BC | BC | | Phone | +15197438620 | +15197308624 | | Email | customer@email.ca | customer+denied@email.ca | #### Czechia | | Approved | Denied | | ------------- | ------------------ | ------------------------ | | Date of Birth | 01-01-1970 | 27-06-1992 | | First Name | Test | Test | | Last Name | Person-cz | Person-cz | | Email | customer@email.cz | customer+denied@email.cz | | Street | Zazvorkova 1480/11 | Zázvorkova 1480/11 | | Postal code | 155 00 | 155 00 | | City | Praha | PRAHA 13 | | Phone | +420771613715 | +420771623691 | #### Denmark | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Date of Birth | 01-01-1980 | 10-07-1970 | | First Name | Test | Test | | Last Name | Person-dk | Person-dk | | Email | customer@email.dk | customer+denied@email.dk | | Street | Dantes Plads | Nygårdsvej | | House number | 7 | 65 | | City | København Ø | København Ø | | Postal code | 1556 | 2100 | | Phone | +4542555628 | +4552555348 | #### Finland | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Date of Birth | 01-01-1999 | 01-01-1999 | | First Name | Test | Person FI | | Last Name | Person-fi | Test | | Email | customer@email.fi | customer+denied@email.fi | | Street | Mannerheimintie | Mannerheimintie | | House number | 34 | 34 | | City | Helsinki | Helsinki | | Postal code | 00100 | 00100 | | Phone | +358401234567 | +358401234568 | #### France | | Approved | Denied | | -------------- | ----------------- | ------------------------ | | Date of Birth | 10-07-1990 | 10-07-1990 | | Place of Birth | Paris | Paris | | First Name | Test | Test | | Last Name | Person-fr | Person-fr | | Email | customer@email.fr | customer+denied@email.fr | | Street | rue La Fayette | rue La Fayette | | House number | 33 | 33 | | City | Paris | Paris | | Postal code | 75009 | 75009 | | Phone | +33689854321 | +33687984322 | #### Germany | | Approved | Denied | | ------------- | --------------------- | ------------------------ | | Date of Birth | 10-07-1970 | 10-07-1970 | | First Name | Mock | Test | | Last Name | Mock | Person-de | | Email | customer@email.de | customer+denied@email.de | | Street | Neue Schönhauser Str. | Neue Schönhauser Str. | | House number | 2 | 2 | | City | Berlin | Berlin | | Postal code | 10178 | 10178 | | Phone | +49017614284340 | +49017610927312 | #### Greece | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Tax number | 090000045 | 090000045 | | Date of Birth | 01-01-1960 | 11-11-1970 | | First Name | Test | Test | | Last Name | Person-gr | Test-gr | | Email | customer@email.gr | customer+denied@email.gr | | Street | Kephisias | Baralo | | House number | 37 | 56 | | Postal code | 151 23 | 123 67 | | City | Athina | Athina | | Phone | +306945553624 | +306945553625 | #### Ireland | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Date of Birth | 10-07-1970 | 10-07-1970 | | First Name | Test | Test | | Last Name | Person-ie | Person-ie | | Email | customer@email.ie | customer+denied@email.ie | | Street | King Street South | King Street South | | House Number | 30 | 30 | | City | Dublin | Dublin | | EIR Code | D02 C838 | D02 C838 | | Phone | +353855351400 | +353855351401 | #### Italy | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Date of Birth | 01-01-1980 | 01-01-1980 | | First Name | Test | Test | | Last Name | Person-it | Person-it | | Email | customer@email.it | customer+denied@email.it | | Fiscal code | RSSBNC80A41H501B | RSSBNC80A41H501B | | Street | Via Enrico Fermi | Via Enrico Fermi | | House number | 150 | 150 | | City | Roma | Roma | | Postal code | 00146 | 00146 | | Phone | +393339741231 | +393312232389 | #### Netherlands | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Date of Birth | 10-07-1970 | 10-07-1970 | | First Name | Test | Test | | Last Name | Person-nl | Person-nl | | Email | customer@email.nl | customer+denied@email.nl | | Street | Osdorpplein | Osdorpplein | | House number | 137 | 137 | | City | Amsterdam | Amsterdam | | Postal code | 1068 SR | 1068 SR | | Phone | +31689124321 | +31632167678 | #### New Zealand | | Approved | Denied | | ------------- | ------------------------ | ------------------------ | | Date of Birth | 10-07-1970 | 10-07-1970 | | First Name | Test | Test | | Last Name | Person-nz | Person-nz | | Street | Mount Wellington Highway | Mount Wellington Highway | | House number | 286 | 286 | | Postal Code | 6011 | 6011 | | City | Auckland | Wellington | | Phone | +6427555290 | +642993007712 | | Email | customer@email.nz | customer+denied@email.nz | #### Norway | | Approved | Denied | | --------------- | ------------------- | ------------------------ | | Date of Birth | 01-08-1970 | 01-08-1970 | | First Name | Jane | Test | | Last Name | Test | Person-no | | Email | customer@email.no | customer+denied@email.no | | Personal number | NO1087000571 | NO1087000148 | | Street | Edvard Munchs Plass | Sæffleberggate | | House Number | 1 | 56 | | City | Oslo | Oslo | | Postal code | 0194 | 0563 | | Phone | +4740123456 | +4740123457 | #### Poland | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Date of Birth | 05-05-1967 | 05-05-1967 | | First Name | Test | Test | | Last Name | Person-pl | Person-pl | | Street | Ul. Górczewska | Ul. Górczewska | | House number | 124 | 124 | | Postal Code | 01-460 | 01-460 | | City | Warszawa | Warszawa | | Phone | +48795222223 | +48795223325 | | Email | customer@email.pl | customer+denied@email.pl | #### Portugal | | Approved | Denied | | ------------- | ------------------- | ------------------------ | | Date of Birth | 10-07-1970 | 10-07-1970 | | First Name | Test | Test | | Last Name | Person-pt | Person-pt | | Street | Avenida Dom João II | Avenida Dom João II | | House number | 40 | 40 | | Postal Code | 1990-094 | 1990-094 | | City | Lisboa | Lisboa | | Phone | +351935556731 | +351915593837 | | Email | customer@email.pt | customer+denied@email.pt | #### Romania | | Approved | Denied | | ------------------------------------ | ----------------- | ------------------------ | | Date of Birth | 25-12-1970 | 25-12-1970 | | First Name | Test | Test | | Last Name | Person-ro | Person-ro | | Email | customer@email.ro | customer+denied@email.ro | | Street | Drumul Taberei | Drumul Taberei | | House number | 35 | 35 | | City | București | București | | Sector | Sectorul 6 | Sectorul 6 | | Postal code | 061357 | 061357 | | Phone | +40741209876 | +40707127444 | | Personal Identification Number (CNP) | 1701225193558 | | #### Spain | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | DNI/NIE | 99999999R | 99999999R | | Date of Birth | 10-07-1970 | 10-07-1970 | | First Name | Test | Test | | Last Name | Person-es | Person-es | | Email | customer@email.es | customer+denied@email.es | | Street | C. de Atocha | C. de Atocha | | House number | 27 | 27 | | City | Madrid | Madrid | | Postal code | 28012 | 28012 | | Phone | +34672563009 | +34682425101 | #### Sweden | | Approved | Denied | | ------------- | ----------------------- | ------------------------ | | Date of Birth | 21-03-1941 | 28-10-1941 | | First Name | Alice | Test | | Last Name | Test | Person-se | | Email | customer@email.se | customer+denied@email.se | | Street | Södra Blasieholmshamnen | Karlaplan | | House number | 2 | 3 | | City | Stockholm | Stockholm | | Postal code | 11 148 | 11 460 | | Phone | +46701740615 | +46701740620 | #### Switzerland | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Date of Birth | 01-01-1990 | 01-01-2000 | | First Name | Accepted | Customer | | Last Name | Person-ch | Person-ch | | Street | Augustinergasse | Bahnhofstrasse | | House number | 2 | 77 | | Postal Code | 4051 | 8001 | | City | Basel | Zürich | | Phone | +41758680000 | +41758680001 | | Email | customer@email.ch | customer+denied@email.ch | #### United Kingdom | | Approved | Denied | | ------------- | --------------------- | ------------------------ | | Date of Birth | 10-07-1970 | 10-07-1970 | | First Name | Test | Test | | Last Name | Person-uk | Person-uk | | Email | customer@email.uk | customer+denied@email.uk | | Street | New Burlington Street | New Burlington Street | | House number | 10 | 10 | | Apartment | Apt 214 | Apt 214 | | Postal code | W1S 3BE | W1S 3BE | | City | London | London | | Phone | +447755564318 | +447355505530 | #### United States | | Approved | Denied | | ------------- | ----------------- | ------------------------ | | Date of Birth | 07-10-1970 | 07-10-1970 | | First Name | Test | Test | | Last Name | Person-us | Person-us | | Email | customer@email.us | customer+denied@email.us | | Street | Amsterdam Ave | Amsterdam Ave | | House number | 509 | 509 | | City | New York | New York | | State | New York | New York | | Postal code | 10024-3941 | 10024-3941 | | Phone | +13106683312 | +13106354386 | ### Two-step authentication Any six digit number is a valid two-step authentication code. Use `999999` for authentication to fail. ### Repayment method Inside the Klarna flow, you can use the following test values to try various repayment types: | Type | Value | | ------------- | --------------------------------------------------------------------------------------- | | Direct Debit | DE11520513735120710131 | | Bank transfer | Demo Bank | | Credit Card | - Number: 4111 1111 1111 1111 - CVV: 123 - Expiration: any valid date in the future | | Debit Card | - Number: 4012 8888 8888 1881 - CVV: 123 - Expiration: any valid date in the future | ## Optional: Handle the Klarna redirect manually [Server-side] We recommend relying on Stripe.js to handle Klarna redirects and billing authorizations on the client. Using the native SDK allows you to extend your integration to other payment methods. However, you can manually redirect your customers on your server using the following steps. *Confirm* (Confirming an intent indicates that the customer intends to use the current or provided payment method. Upon confirmation, the intent attempts to initiate the portions of the flow that have real-world side effects) the PaymentIntent or SetupIntent at creation time by including `confirm: true`. Provide a `return_url` to indicate where Stripe needs to redirect the user after they complete the setup on Klarna’s website or mobile application. The Intent status is `requires_action` and the `next_action` type is `redirect_to_url`. ```json { "id": "seti_1IQ9hjJJahOk1vSNevPWnhEN", "object": "setup_intent","status": "requires_action", "next_action": { "type": "redirect_to_url", "redirect_to_url": { "url": "https://hooks.stripe.com/...", "return_url": "https://example.com/setup/complete" } }, "application": null, "cancellation_reason": null, "client_secret": "seti_1IQ9hjJJahOk1vSNevPWnhEN_secret_J2EAlI0GQbQKV9tg7ITRcUWRBiAwvUV", "created": 1614597263, "customer": null, "description": null, "last_setup_error": null, "latest_attempt": "setatt_1IQ9hkJJahOk1vSN0rsCpnLI", "livemode": false, "mandate": null, "metadata": {}, "next_action": null, "on_behalf_of": null, "payment_method": "pm_1IQ9hjJJahOk1vSNDc5lQWia", "payment_method_options": {}, "payment_method_types": ["klarna"], "single_use_mandate": null, "usage": "off_session" } ``` Redirect the customer to the URL provided in the `next_action.redirect_to_url.url` property. ## Optional: Upgrade a saved payment method [Server-side] Bringing the customer through the Klarna payment flow again if they upgrade their subscription. This ensures Klarna has the most accurate subscription information and optimizes authorization rates. #### Upgrade and charge renewal Create a [PaymentIntent](https://docs.stripe.com/api/payment_intents.md) with the same structure as when you charge a saved payment method and include `setup_future_usage` to indicate that you want to upgrade the existing payment method. Pass the new subscription information and use the same `reference` as when you first saved the payment method. ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=10000 \ -d currency=usd \ -d customer={{CUSTOMER_ID}} \ -d payment_method={{PAYMENT_METHOD_ID}} \ -d setup_future_usage=off_session \ --data-urlencode "return_url=https://example.com/setup/complete" \ -d "amount_details[line_items][0][product_name]=Annual subscription renewal" \ -d "amount_details[line_items][0][quantity]=1" \ -d "amount_details[line_items][0][unit_cost]=10000" \ -d "amount_details[line_items][0][payment_method_options][klarna][subscription_reference]=EXAMPLE_REFERENCE" \ -d "payment_method_options[klarna][subscriptions][0][reference]=EXAMPLE_REFERENCE" \ -d "payment_method_options[klarna][subscriptions][0][interval]=year" ``` The resulting PaymentIntent requires a redirect to Klarna to be completed. Learn [how to handle the redirect](https://docs.stripe.com/payments/klarna/set-up-future-payments.md?web-or-mobile=web&payment-ui=elements#web-redirect-customer). #### Upgrade and charge later Create a [SetupIntent](https://docs.stripe.com/api/payment_intents.md) and pass the existing saved payment method. Pass the new subscription information and use the same `reference` as when you first saved the payment method. ```curl curl https://api.stripe.com/v1/setup_intents \ -u "<>:" \ -d customer={{CUSTOMER_ID}} \ -d payment_method={{PAYMENT_METHOD_ID}} \ --data-urlencode "return_url=https://example.com/setup/complete" \ -d "payment_method_options[klarna][currency]=usd" \ -d "payment_method_options[klarna][subscriptions][0][reference]=EXAMPLE_REFERENCE" \ -d "payment_method_options[klarna][subscriptions][0][interval]=annual" \ -d "payment_method_options[klarna][subscriptions][0][next_billing][amount]=20000" \ -d "payment_method_options[klarna][subscriptions][0][next_billing][date]=2026-01-01" ``` The resulting SetupIntent requires a redirect to Klarna to be completed. Learn how to [handle the redirect](https://docs.stripe.com/payments/klarna/set-up-future-payments.md?web-or-mobile=web&payment-ui=elements#web-redirect-customer). ## Optional: Remove a saved Klarna account [Server-side] You can use the [detach](https://docs.stripe.com/api/payment_methods/detach.md) API to remove a customer’s saved Klarna account as a payment method. Remove a Klarna account when you know it won’t be used again, such as when the customer cancels their subscription. ```curl curl -X POST https://api.stripe.com/v1/payment_methods/{{PAYMENT_METHOD_ID}}/detach \ -u "<>:" ```