--- title: "Klarna Redirect Component" description: "Add Klarna to your existing iOS Components integration." url: "https://docs.adyen.com/payment-methods/klarna/ios-component" source_url: "https://docs.adyen.com/payment-methods/klarna/ios-component.md" canonical: "https://docs.adyen.com/payment-methods/klarna/ios-component" last_modified: "2026-05-24T12:54:31+02:00" language: "en" --- # Klarna Redirect Component Add Klarna to your existing iOS Components integration. [View source](/payment-methods/klarna/ios-component.md) This page explains how to add Klarna to your existing iOS Components integration. ## Requirements Select the [server-side flow](/online-payments/build-your-integration) that your integration uses: ### Tab: Sessions flow | Requirement | Description | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | Make sure that you have built a Sessions flow [iOS Components integration](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Components). | | **Setup steps** | Before you begin, [add Klarna in your Customer Area](/payment-methods/add-payment-methods). | ### Tab: Advanced flow | Requirement | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Integration type** | Make sure that you have built an Advanced flow [iOS Components integration](/online-payments/build-your-integration/advanced-flow?platform=iOS\&integration=Components). | | **Setup steps** | Before you begin, [add Klarna in your Customer Area](/payment-methods/add-payment-methods). | ## API reference Select which endpoint you are using: ### Tab: `/sessions` This is the default with [Components v5.0.0](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Components) or later. | Parameter name | Required | Description | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-lineItems) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Price and product information about the purchased items. Klarna only approves the payment if the total amount specified in `lineItems` matches the `amount.value`, and each line item contains a `description`. You can optionally specify `productUrl` and `imageUrl` to include a link to and a picture of the purchased items in the invoice. See [Klarna for airlines](/payment-methods/klarna/airlines/) for details on how to use `lineItems` when payments are made to an airline. | | [shopperEmail](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-shopperEmail) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") See note[ 1](#shopperEmail) | The shopper's email address. This is where Klarna will send the payment instructions. For requirements on this field, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market). | | [shopperReference](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/sessions__reqParam_shopperReference) | | A unique reference to identify the shopper (minimum length three characters). | | [shopperName](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-shopperName) | | The shopper's full name. Recommended to increase conversion rates. If you do not include it, Klarna will ask the shopper to provide this in the checkout page. For requirements on this field, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market). | | [billingAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-billingAddress) | | The postal address of the shopper. Recommended to increase conversion rates. If you do not include it, Klarna will ask the shopper to provide this in the checkout page. For requirements on this field, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market). | | [deliveryAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-deliveryAddress) | | The postal address where the purchased goods should be delivered. If not provided, this is the same as the billing address. For requirements on this field, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market). If the recipient name is different from the shopper making the payment, specify `deliveryAddress.firstName` and `deliveryAddress.lastName` to share the recipient name with Klarna. | | [shopperLocale](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/sessions__reqParam_shopperLocale) | | A combination of language code and country code to define the language of the Klarna checkout page. By default, the checkout page is rendered is English. This has to match the `countryCode` and `currency` used in the request. For more information, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/puchase-countries-currencies-locales/). | | [countryCode](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/sessions__reqParam_countryCode) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's [country](/payment-methods/klarna#supported-countries). This has to match the country of the `billingAddress`. | | [telephoneNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-telephoneNumber) | | The shopper's telephone number, if provided. For requirements on this field, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market). | | [additionalData. openinvoicedata.merchantData](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/sessions__reqParam_additionalData-AdditionalDataOpenInvoice-openinvoicedata-merchantData) | | For some products or business models, Klarna may require additional information. If you need to send in this information, specify here the Base64 encoded JSON of the `attachment.body` value described in [Klarna's documentation](https://docs.klarna.com/api/attachment-schema/). See [Klarna for airlines](/payment-methods/klarna/airlines/) for details on how to use `additionalData` when payments are made to an airline. Do not include this in the test environment, because test values cause an error. | []()1You need to include `shopperEmail` to defend against potential disputes from shoppers. #### curl ```bash curl https://checkout-test.adyen.com/v70/sessions \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "reference": "YOUR_ORDER_REFERENCE", "amount": { "currency": "SEK", "value": 1000 }, "shopperLocale": "en_US", "countryCode": "SE", "telephoneNumber": "+46 840 839 298", "shopperEmail": "youremail@email.com", "shopperName": { "firstName": "Testperson-se", "lastName": "Approved" }, "shopperReference": "YOUR_UNIQUE_SHOPPER_ID", "billingAddress": { "city": "Ankeborg", "country": "SE", "houseNumberOrName": "1", "postalCode": "12345", "street": "Stargatan" }, "deliveryAddress": { "city": "Ankeborg", "country": "SE", "houseNumberOrName": "1", "postalCode": "12345", "street": "Stargatan" }, "dateOfBirth": "1996-09-04", "socialSecurityNumber": "0108", "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy..", "lineItems": [ { "quantity": "1", "taxPercentage": "2100", "description": "Shoes", "id": "Item #1", "amountIncludingTax": "400", "productUrl": "URL_TO_PURCHASED_ITEM", "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM" }, { "quantity": "2", "taxPercentage": "2100", "description": "Socks", "id": "Item #2", "amountIncludingTax": "300", "productUrl": "URL_TO_PURCHASED_ITEM", "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM" } ] }' ``` #### Java ```java // Adyen Java API Library v27.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the live environment, additionally include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) Amount amount = new Amount() .currency("SEK") .value(1000L); LineItem lineItem1 = new LineItem() .quantity(1L) .taxPercentage(2100L) .imageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM") .description("Shoes") .id("Item #1") .amountIncludingTax(400L) .productUrl("URL_TO_PURCHASED_ITEM"); LineItem lineItem2 = new LineItem() .quantity(2L) .taxPercentage(2100L) .imageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM") .description("Socks") .id("Item #2") .amountIncludingTax(300L) .productUrl("URL_TO_PURCHASED_ITEM"); Name name = new Name() .firstName("Testperson-se") .lastName("Approved"); DeliveryAddress deliveryAddress = new DeliveryAddress() .country("SE") .city("Ankeborg") .houseNumberOrName("1") .street("Stargatan") .postalCode("12345"); BillingAddress billingAddress = new BillingAddress() .country("SE") .city("Ankeborg") .houseNumberOrName("1") .street("Stargatan") .postalCode("12345"); CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest() .amount(amount) .telephoneNumber("+46 840 839 298") .socialSecurityNumber("0108") .shopperEmail("youremail@email.com") .reference("YOUR_ORDER_REFERENCE") .lineItems(Arrays.asList(lineItem1, lineItem2)) .shopperName(name) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .deliveryAddress(deliveryAddress) .countryCode("SE") .shopperLocale("en_US") .billingAddress(billingAddress) .returnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..") .shopperReference("YOUR_UNIQUE_SHOPPER_ID"); // Send the request PaymentsApi service = new PaymentsApi(client); CreateCheckoutSessionResponse response = service.sessions(createCheckoutSessionRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php // Adyen PHP API Library v19.0.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\Checkout\Amount; use Adyen\Model\Checkout\LineItem; use Adyen\Model\Checkout\Name; use Adyen\Model\Checkout\DeliveryAddress; use Adyen\Model\Checkout\BillingAddress; use Adyen\Model\Checkout\CreateCheckoutSessionRequest; use Adyen\Service\Checkout\PaymentsApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); // For the live environment, additionally include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $amount = new Amount(); $amount ->setCurrency("SEK") ->setValue(1000); $lineItem1 = new LineItem(); $lineItem1 ->setQuantity(1) ->setTaxPercentage(2100) ->setImageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM") ->setDescription("Shoes") ->setId("Item #1") ->setAmountIncludingTax(400) ->setProductUrl("URL_TO_PURCHASED_ITEM"); $lineItem2 = new LineItem(); $lineItem2 ->setQuantity(2) ->setTaxPercentage(2100) ->setImageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM") ->setDescription("Socks") ->setId("Item #2") ->setAmountIncludingTax(300) ->setProductUrl("URL_TO_PURCHASED_ITEM"); $name = new Name(); $name ->setFirstName("Testperson-se") ->setLastName("Approved"); $deliveryAddress = new DeliveryAddress(); $deliveryAddress ->setCountry("SE") ->setCity("Ankeborg") ->setHouseNumberOrName("1") ->setStreet("Stargatan") ->setPostalCode("12345"); $billingAddress = new BillingAddress(); $billingAddress ->setCountry("SE") ->setCity("Ankeborg") ->setHouseNumberOrName("1") ->setStreet("Stargatan") ->setPostalCode("12345"); $createCheckoutSessionRequest = new CreateCheckoutSessionRequest(); $createCheckoutSessionRequest ->setAmount($amount) ->setTelephoneNumber("+46 840 839 298") ->setSocialSecurityNumber("0108") ->setShopperEmail("youremail@email.com") ->setReference("YOUR_ORDER_REFERENCE") ->setLineItems(array($lineItem1, $lineItem2)) ->setShopperName($name) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setDeliveryAddress($deliveryAddress) ->setCountryCode("SE") ->setShopperLocale("en_US") ->setBillingAddress($billingAddress) ->setReturnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..") ->setShopperReference("YOUR_UNIQUE_SHOPPER_ID"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->sessions($createCheckoutSessionRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v17.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the live environment, additionally include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) Amount amount = new Amount { Currency = "SEK", Value = 1000 }; LineItem lineItem1 = new LineItem { Quantity = 1, TaxPercentage = 2100, ImageUrl = "URL_TO_PICTURE_OF_PURCHASED_ITEM", Description = "Shoes", Id = "Item #1", AmountIncludingTax = 400, ProductUrl = "URL_TO_PURCHASED_ITEM" }; LineItem lineItem2 = new LineItem { Quantity = 2, TaxPercentage = 2100, ImageUrl = "URL_TO_PICTURE_OF_PURCHASED_ITEM", Description = "Socks", Id = "Item #2", AmountIncludingTax = 300, ProductUrl = "URL_TO_PURCHASED_ITEM" }; Name name = new Name { FirstName = "Testperson-se", LastName = "Approved" }; DeliveryAddress deliveryAddress = new DeliveryAddress { Country = "SE", City = "Ankeborg", HouseNumberOrName = "1", Street = "Stargatan", PostalCode = "12345" }; BillingAddress billingAddress = new BillingAddress { Country = "SE", City = "Ankeborg", HouseNumberOrName = "1", Street = "Stargatan", PostalCode = "12345" }; CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest { Amount = amount, TelephoneNumber = "+46 840 839 298", SocialSecurityNumber = "0108", ShopperEmail = "youremail@email.com", Reference = "YOUR_ORDER_REFERENCE", LineItems = new List{ lineItem1, lineItem2 }, ShopperName = name, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", DeliveryAddress = deliveryAddress, CountryCode = "SE", ShopperLocale = "en_US", BillingAddress = billingAddress, AdditionalData = new Dictionary ReturnUrl = "https://your-company.example.com/checkout?shopperOrder=12xy..", ShopperReference = "YOUR_UNIQUE_SHOPPER_ID" }; // Send the request var service = new PaymentsService(client); var response = service.Sessions(createCheckoutSessionRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v16.1.0 // Require the parts of the module you want to use const { Client, CheckoutAPI } = require('@adyen/api-library'); // Initialize the client object const client = new Client({apiKey: "YOUR_X_API_KEY", environment: "TEST"}); // Create the request object const createCheckoutSessionRequest = { merchantAccount: "YOUR_MERCHANT_ACCOUNT", reference: "YOUR_ORDER_REFERENCE", amount: { currency: "SEK", value: 1000 }, shopperLocale: "en_US", countryCode: "SE", telephoneNumber: "+46 840 839 298", shopperEmail: "youremail@email.com", shopperName: { firstName: "Testperson-se", lastName: "Approved" }, shopperReference: "YOUR_UNIQUE_SHOPPER_ID", billingAddress: { city: "Ankeborg", country: "SE", houseNumberOrName: "1", postalCode: "12345", street: "Stargatan" }, deliveryAddress: { city: "Ankeborg", country: "SE", houseNumberOrName: "1", postalCode: "12345", street: "Stargatan" }, dateOfBirth: new Date("1996-09-04"), socialSecurityNumber: "0108", returnUrl: "my-app://adyen", lineItems: [ { quantity: "1", taxPercentage: "2100", description: "Shoes", id: "Item #1", amountIncludingTax: "400", productUrl: "URL_TO_PURCHASED_ITEM", imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM" }, { quantity: "2", taxPercentage: "2100", description: "Socks", id: "Item #2", amountIncludingTax: "300", productUrl: "URL_TO_PURCHASED_ITEM", imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM" } ] } // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v10.4.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/checkout" ) // For the live environment, additionally include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) amount := checkout.Amount{ Currency: "SEK", Value: 1000, } lineItem1 := checkout.LineItem{ Quantity: common.PtrInt64(1), TaxPercentage: common.PtrInt64(2100), ImageUrl: common.PtrString("URL_TO_PICTURE_OF_PURCHASED_ITEM"), Description: common.PtrString("Shoes"), Id: common.PtrString("Item #1"), AmountIncludingTax: common.PtrInt64(400), ProductUrl: common.PtrString("URL_TO_PURCHASED_ITEM"), } lineItem2 := checkout.LineItem{ Quantity: common.PtrInt64(2), TaxPercentage: common.PtrInt64(2100), ImageUrl: common.PtrString("URL_TO_PICTURE_OF_PURCHASED_ITEM"), Description: common.PtrString("Socks"), Id: common.PtrString("Item #2"), AmountIncludingTax: common.PtrInt64(300), ProductUrl: common.PtrString("URL_TO_PURCHASED_ITEM"), } name := checkout.Name{ FirstName: "Testperson-se", LastName: "Approved", } deliveryAddress := checkout.DeliveryAddress{ Country: "SE", City: "Ankeborg", HouseNumberOrName: "1", Street: "Stargatan", PostalCode: "12345", } billingAddress := checkout.BillingAddress{ Country: "SE", City: "Ankeborg", HouseNumberOrName: "1", Street: "Stargatan", PostalCode: "12345", } createCheckoutSessionRequest := checkout.CreateCheckoutSessionRequest{ Amount: amount, TelephoneNumber: common.PtrString("+46 840 839 298"), SocialSecurityNumber: common.PtrString("0108"), ShopperEmail: common.PtrString("youremail@email.com"), Reference: "YOUR_ORDER_REFERENCE", LineItems: []checkout.LineItem{ lineItem1, lineItem2, }, ShopperName: &name, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", DeliveryAddress: &deliveryAddress, CountryCode: common.PtrString("SE"), ShopperLocale: common.PtrString("en_US"), BillingAddress: &billingAddress, ReturnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", ShopperReference: common.PtrString("YOUR_UNIQUE_SHOPPER_ID"), } // Send the request service := client.Checkout() req := service.PaymentsApi.SessionsInput().IdempotencyKey("UUID").CreateCheckoutSessionRequest(createCheckoutSessionRequest) res, httpRes, err := service.PaymentsApi.Sessions(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.0.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "YOUR_X_API_KEY" adyen.client.platform = "test" # The environment to use library in. json_request = { "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "reference": "YOUR_ORDER_REFERENCE", "amount": { "currency": "SEK", "value": 1000 }, "shopperLocale": "en_US", "countryCode": "SE", "telephoneNumber": "+46 840 839 298", "shopperEmail": "youremail@email.com", "shopperName": { "firstName": "Testperson-se", "lastName": "Approved" }, "shopperReference": "YOUR_UNIQUE_SHOPPER_ID", "billingAddress": { "city": "Ankeborg", "country": "SE", "houseNumberOrName": "1", "postalCode": "12345", "street": "Stargatan" }, "deliveryAddress": { "city": "Ankeborg", "country": "SE", "houseNumberOrName": "1", "postalCode": "12345", "street": "Stargatan" }, "dateOfBirth": "1996-09-04", "socialSecurityNumber": "0108", "returnUrl": "my-app://adyen", "lineItems": [ { "quantity": "1", "taxPercentage": "2100", "description": "Shoes", "id": "Item #1", "amountIncludingTax": "400", "productUrl": "URL_TO_PURCHASED_ITEM", "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM" }, { "quantity": "2", "taxPercentage": "2100", "description": "Socks", "id": "Item #2", "amountIncludingTax": "300", "productUrl": "URL_TO_PURCHASED_ITEM", "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM" } ] } result = adyen.checkout.payments_api.sessions(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v9.1.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'YOUR_X_API_KEY' adyen.env = :test # Set to "live" for live environment request_body = { :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :reference => 'YOUR_ORDER_REFERENCE', :amount => { :currency => 'SEK', :value => 1000 }, :shopperLocale => 'en_US', :countryCode => 'SE', :telephoneNumber => '+46 840 839 298', :shopperEmail => 'youremail@email.com', :shopperName => { :firstName => 'Testperson-se', :lastName => 'Approved' }, :shopperReference => 'YOUR_UNIQUE_SHOPPER_ID', :billingAddress => { :city => 'Ankeborg', :country => 'SE', :houseNumberOrName => '1', :postalCode => '12345', :street => 'Stargatan' }, :deliveryAddress => { :city => 'Ankeborg', :country => 'SE', :houseNumberOrName => '1', :postalCode => '12345', :street => 'Stargatan' }, :dateOfBirth => '1996-09-04', :socialSecurityNumber => '0108', :returnUrl => 'my-app://adyen', :lineItems => [ { :quantity => '1', :taxPercentage => '2100', :description => 'Shoes', :id => 'Item #1', :amountIncludingTax => '400', :productUrl => 'URL_TO_PURCHASED_ITEM', :imageUrl => 'URL_TO_PICTURE_OF_PURCHASED_ITEM' }, { :quantity => '2', :taxPercentage => '2100', :description => 'Socks', :id => 'Item #2', :amountIncludingTax => '300', :productUrl => 'URL_TO_PURCHASED_ITEM', :imageUrl => 'URL_TO_PICTURE_OF_PURCHASED_ITEM' } ] } result = adyen.checkout.payments_api.sessions(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v18.0.0 // Require the parts of the module you want to use import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const amount: Types.checkout.Amount = { currency: "SEK", value: 1000 }; const lineItem1: Types.checkout.LineItem = { quantity: 1, taxPercentage: 2100, imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM", description: "Shoes", id: "Item #1", amountIncludingTax: 400, productUrl: "URL_TO_PURCHASED_ITEM" }; const lineItem2: Types.checkout.LineItem = { quantity: 2, taxPercentage: 2100, imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM", description: "Socks", id: "Item #2", amountIncludingTax: 300, productUrl: "URL_TO_PURCHASED_ITEM" }; const name: Types.checkout.Name = { firstName: "Testperson-se", lastName: "Approved" }; const deliveryAddress: Types.checkout.DeliveryAddress = { country: "SE", city: "Ankeborg", houseNumberOrName: "1", street: "Stargatan", postalCode: "12345" }; const billingAddress: Types.checkout.BillingAddress = { country: "SE", city: "Ankeborg", houseNumberOrName: "1", street: "Stargatan", postalCode: "12345" }; const createCheckoutSessionRequest: Types.checkout.CreateCheckoutSessionRequest = { amount: amount, telephoneNumber: "+46 840 839 298", socialSecurityNumber: "0108", shopperEmail: "youremail@email.com", reference: "YOUR_ORDER_REFERENCE", lineItems: [lineItem1, lineItem2], shopperName: name, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", deliveryAddress: deliveryAddress, countryCode: "SE", shopperLocale: "en_US", billingAddress: billingAddress, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_UNIQUE_SHOPPER_ID" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" }); ``` ### Tab: `/payments` If you implemented an [additional use case](/online-payments/build-your-integration). | Parameter name | Required | Description | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Price and product information about the purchased items. For Klarna to approve the payment, the total amount specified in `lineItems` must match the `amount.value`, and each line item must include a `description`. You can optionally specify `productUrl` and `imageUrl` to include a link to and a picture of the purchased items in the invoice. See [Klarna for airlines](/payment-methods/klarna/airlines/) for details on how to use `lineItems` when payments are made to an airline. | | [shopperEmail](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperEmail) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") See note[ 1](#shopperEmail) | The shopper's email address. This is where Klarna will send the payment instructions. For requirements on this field, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market). | | [shopperReference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperReference) | | A unique reference to identify the shopper (minimum length three characters). | | [shopperName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperName) | | The shopper's full name. Recommended to increase conversion rates. If you do not include it, Klarna will ask the shopper to provide this in the checkout page. For requirements on this field, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market). | | [billingAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-billingAddress) | | The postal address of the shopper. Recommended to increase conversion rates. If you do not include it, Klarna will ask the shopper to provide this in the checkout page. For requirements on this field, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market). | | [deliveryAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-deliveryAddress) | | The postal address where the purchased goods should be delivered. If not provided, this is the same as the billing address. For requirements on this field, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market). If the recipient name is different from the shopper making the payment, specify `deliveryAddress.firstName` and `deliveryAddress.lastName` to share the recipient name with Klarna. | | [shopperLocale](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperLocale) | | A combination of language code and country code to define the language of the Klarna checkout page. By default, the checkout page is rendered is English. This has to match the `countryCode` and `currency` used in the request. For more information, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/puchase-countries-currencies-locales/). | | [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-countryCode) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's [country](/payment-methods/klarna#supported-countries). This has to match the country of the `billingAddress`. | | [telephoneNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-telephoneNumber) | | The shopper's telephone number, if provided. For requirements on this field, see [Klarna's documentation](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market). | | [additionalData. openinvoicedata.merchantData](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/payments__reqParam_additionalData-AdditionalDataOpenInvoice-openinvoicedata-merchantData) | | For some products or business models, Klarna can require additional information. If you need to send in this information, specify here the Base64 encoded JSON of the `attachment.body` value described in [Klarna's documentation](https://docs.klarna.com/api/attachment-schema/). See [Klarna for airlines](/payment-methods/klarna/airlines/) for details on how to use `additionalData` when payments are made to an airline. Do not include this in the test environment, because test values cause an error. | []()1You need to include `shopperEmail` to defend against potential disputes from shoppers. #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount":"ADYEN_MERCHANT_ACCOUNT", "reference":"YOUR_ORDER_REFERENCE", "paymentMethod":{ "type":"klarna" }, "amount":{ "currency":"SEK", "value": 1000 }, "shopperLocale":"en_US", "countryCode":"SE", "telephoneNumber": "+46 840 839 298", "shopperEmail":"youremail@email.com", "shopperName":{ "firstName":"Testperson-se", "lastName":"Approved" }, "shopperReference":"YOUR_UNIQUE_SHOPPER_ID", "billingAddress":{ "city":"Ankeborg", "country":"SE", "houseNumberOrName":"1", "postalCode":"12345", "street":"Stargatan" }, "deliveryAddress":{ "city":"Ankeborg", "country":"SE", "houseNumberOrName":"1", "postalCode":"12345", "street":"Stargatan" }, "returnUrl":"https://your-company.example.com/checkout?shopperOrder=12xy..", "lineItems":[ { "quantity":"1", "taxPercentage":"2100", "description":"Shoes", "id":"Item #1", "amountIncludingTax":"400", "productUrl": "URL_TO_PURCHASED_ITEM", "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM" }, { "quantity":"2", "taxPercentage":"2100", "description":"Socks", "id":"Item #2", "amountIncludingTax":"300", "productUrl": "URL_TO_PURCHASED_ITEM", "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM" } ] }' ``` #### Java ```java // Adyen Java API Library v27.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the live environment, additionally include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) Amount amount = new Amount() .currency("SEK") .value(1000L); LineItem lineItem1 = new LineItem() .quantity(1L) .taxPercentage(2100L) .imageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM") .description("Shoes") .id("Item #1") .amountIncludingTax(400L) .productUrl("URL_TO_PURCHASED_ITEM"); LineItem lineItem2 = new LineItem() .quantity(2L) .taxPercentage(2100L) .imageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM") .description("Socks") .id("Item #2") .amountIncludingTax(300L) .productUrl("URL_TO_PURCHASED_ITEM"); Name name = new Name() .firstName("Testperson-se") .lastName("Approved"); DeliveryAddress deliveryAddress = new DeliveryAddress() .country("SE") .city("Ankeborg") .houseNumberOrName("1") .street("Stargatan") .postalCode("12345"); KlarnaDetails klarnaDetails = new KlarnaDetails() .type(KlarnaDetails.TypeEnum.KLARNA); BillingAddress billingAddress = new BillingAddress() .country("SE") .city("Ankeborg") .houseNumberOrName("1") .street("Stargatan") .postalCode("12345"); PaymentRequest paymentRequest = new PaymentRequest() .amount(amount) .telephoneNumber("+46 840 839 298") .shopperEmail("youremail@email.com") .reference("YOUR_ORDER_REFERENCE") .lineItems(Arrays.asList(lineItem1, lineItem2)) .shopperName(name) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .deliveryAddress(deliveryAddress) .countryCode("SE") .paymentMethod(new CheckoutPaymentMethod(klarnaDetails)) .shopperLocale("en_US") .billingAddress(billingAddress) .returnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..") .shopperReference("YOUR_UNIQUE_SHOPPER_ID"); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php // Adyen PHP API Library v19.0.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\Checkout\Amount; use Adyen\Model\Checkout\LineItem; use Adyen\Model\Checkout\Name; use Adyen\Model\Checkout\DeliveryAddress; use Adyen\Model\Checkout\CheckoutPaymentMethod; use Adyen\Model\Checkout\BillingAddress; use Adyen\Model\Checkout\PaymentRequest; use Adyen\Service\Checkout\PaymentsApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); // For the live environment, additionally include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $amount = new Amount(); $amount ->setCurrency("SEK") ->setValue(1000); $lineItem1 = new LineItem(); $lineItem1 ->setQuantity(1) ->setTaxPercentage(2100) ->setImageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM") ->setDescription("Shoes") ->setId("Item #1") ->setAmountIncludingTax(400) ->setProductUrl("URL_TO_PURCHASED_ITEM"); $lineItem2 = new LineItem(); $lineItem2 ->setQuantity(2) ->setTaxPercentage(2100) ->setImageUrl("URL_TO_PICTURE_OF_PURCHASED_ITEM") ->setDescription("Socks") ->setId("Item #2") ->setAmountIncludingTax(300) ->setProductUrl("URL_TO_PURCHASED_ITEM"); $name = new Name(); $name ->setFirstName("Testperson-se") ->setLastName("Approved"); $deliveryAddress = new DeliveryAddress(); $deliveryAddress ->setCountry("SE") ->setCity("Ankeborg") ->setHouseNumberOrName("1") ->setStreet("Stargatan") ->setPostalCode("12345"); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setType("klarna"); $billingAddress = new BillingAddress(); $billingAddress ->setCountry("SE") ->setCity("Ankeborg") ->setHouseNumberOrName("1") ->setStreet("Stargatan") ->setPostalCode("12345"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setAmount($amount) ->setTelephoneNumber("+46 840 839 298") ->setShopperEmail("youremail@email.com") ->setReference("YOUR_ORDER_REFERENCE") ->setLineItems(array($lineItem1, $lineItem2)) ->setShopperName($name) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setDeliveryAddress($deliveryAddress) ->setCountryCode("SE") ->setPaymentMethod($checkoutPaymentMethod) ->setShopperLocale("en_US") ->setBillingAddress($billingAddress) ->setReturnUrl("https://your-company.example.com/checkout?shopperOrder=12xy..") ->setShopperReference("YOUR_UNIQUE_SHOPPER_ID"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v17.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the live environment, additionally include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) Amount amount = new Amount { Currency = "SEK", Value = 1000 }; LineItem lineItem1 = new LineItem { Quantity = 1, TaxPercentage = 2100, ImageUrl = "URL_TO_PICTURE_OF_PURCHASED_ITEM", Description = "Shoes", Id = "Item #1", AmountIncludingTax = 400, ProductUrl = "URL_TO_PURCHASED_ITEM" }; LineItem lineItem2 = new LineItem { Quantity = 2, TaxPercentage = 2100, ImageUrl = "URL_TO_PICTURE_OF_PURCHASED_ITEM", Description = "Socks", Id = "Item #2", AmountIncludingTax = 300, ProductUrl = "URL_TO_PURCHASED_ITEM" }; Name name = new Name { FirstName = "Testperson-se", LastName = "Approved" }; DeliveryAddress deliveryAddress = new DeliveryAddress { Country = "SE", City = "Ankeborg", HouseNumberOrName = "1", Street = "Stargatan", PostalCode = "12345" }; KlarnaDetails klarnaDetails = new KlarnaDetails { Type = KlarnaDetails.TypeEnum.Klarna }; BillingAddress billingAddress = new BillingAddress { Country = "SE", City = "Ankeborg", HouseNumberOrName = "1", Street = "Stargatan", PostalCode = "12345" }; PaymentRequest paymentRequest = new PaymentRequest { Amount = amount, TelephoneNumber = "+46 840 839 298", ShopperEmail = "youremail@email.com", Reference = "YOUR_ORDER_REFERENCE", LineItems = new List{ lineItem1, lineItem2 }, ShopperName = name, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", DeliveryAddress = deliveryAddress, CountryCode = "SE", PaymentMethod = new CheckoutPaymentMethod(klarnaDetails), ShopperLocale = "en_US", BillingAddress = billingAddress, ReturnUrl = "https://your-company.example.com/checkout?shopperOrder=12xy..", ShopperReference = "YOUR_UNIQUE_SHOPPER_ID" }; // Send the request var service = new PaymentsService(client); var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v18.0.0 // Require the parts of the module you want to use const { Client, CheckoutAPI } = require('@adyen/api-library'); // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const paymentRequest = { merchantAccount: "ADYEN_MERCHANT_ACCOUNT", reference: "YOUR_ORDER_REFERENCE", paymentMethod: { type: "klarna" }, amount: { currency: "SEK", value: 1000 }, shopperLocale: "en_US", countryCode: "SE", telephoneNumber: "+46 840 839 298", shopperEmail: "youremail@email.com", shopperName: { firstName: "Testperson-se", lastName: "Approved" }, shopperReference: "YOUR_UNIQUE_SHOPPER_ID", billingAddress: { city: "Ankeborg", country: "SE", houseNumberOrName: "1", postalCode: "12345", street: "Stargatan" }, deliveryAddress: { city: "Ankeborg", country: "SE", houseNumberOrName: "1", postalCode: "12345", street: "Stargatan" }, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", lineItems: [ { quantity: "1", taxPercentage: "2100", description: "Shoes", id: "Item #1", amountIncludingTax: "400", productUrl: "URL_TO_PURCHASED_ITEM", imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM" }, { quantity: "2", taxPercentage: "2100", description: "Socks", id: "Item #2", amountIncludingTax: "300", productUrl: "URL_TO_PURCHASED_ITEM", imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM" } ] } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v10.4.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/checkout" ) // For the live environment, additionally include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) amount := checkout.Amount{ Currency: "SEK", Value: 1000, } lineItem1 := checkout.LineItem{ Quantity: common.PtrInt64(1), TaxPercentage: common.PtrInt64(2100), ImageUrl: common.PtrString("URL_TO_PICTURE_OF_PURCHASED_ITEM"), Description: common.PtrString("Shoes"), Id: common.PtrString("Item #1"), AmountIncludingTax: common.PtrInt64(400), ProductUrl: common.PtrString("URL_TO_PURCHASED_ITEM"), } lineItem2 := checkout.LineItem{ Quantity: common.PtrInt64(2), TaxPercentage: common.PtrInt64(2100), ImageUrl: common.PtrString("URL_TO_PICTURE_OF_PURCHASED_ITEM"), Description: common.PtrString("Socks"), Id: common.PtrString("Item #2"), AmountIncludingTax: common.PtrInt64(300), ProductUrl: common.PtrString("URL_TO_PURCHASED_ITEM"), } name := checkout.Name{ FirstName: "Testperson-se", LastName: "Approved", } deliveryAddress := checkout.DeliveryAddress{ Country: "SE", City: "Ankeborg", HouseNumberOrName: "1", Street: "Stargatan", PostalCode: "12345", } klarnaDetails := checkout.KlarnaDetails{ Type: "klarna", } billingAddress := checkout.BillingAddress{ Country: "SE", City: "Ankeborg", HouseNumberOrName: "1", Street: "Stargatan", PostalCode: "12345", } paymentRequest := checkout.PaymentRequest{ Amount: amount, TelephoneNumber: common.PtrString("+46 840 839 298"), ShopperEmail: common.PtrString("youremail@email.com"), Reference: "YOUR_ORDER_REFERENCE", LineItems: []checkout.LineItem{ lineItem1, lineItem2, }, ShopperName: &name, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", DeliveryAddress: &deliveryAddress, CountryCode: common.PtrString("SE"), PaymentMethod: checkout.KlarnaDetailsAsCheckoutPaymentMethod(&klarnaDetails), ShopperLocale: common.PtrString("en_US"), BillingAddress: &billingAddress, ReturnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", ShopperReference: common.PtrString("YOUR_UNIQUE_SHOPPER_ID") } // Send the request service := client.Checkout() req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest) res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.5.1 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the live environment, additionally include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "reference": "YOUR_ORDER_REFERENCE", "paymentMethod": { "type": "klarna" }, "amount": { "currency": "SEK", "value": 1000 }, "shopperLocale": "en_US", "countryCode": "SE", "telephoneNumber": "+46 840 839 298", "shopperEmail": "youremail@email.com", "shopperName": { "firstName": "Testperson-se", "lastName": "Approved" }, "shopperReference": "YOUR_UNIQUE_SHOPPER_ID", "billingAddress": { "city": "Ankeborg", "country": "SE", "houseNumberOrName": "1", "postalCode": "12345", "street": "Stargatan" }, "deliveryAddress": { "city": "Ankeborg", "country": "SE", "houseNumberOrName": "1", "postalCode": "12345", "street": "Stargatan" }, "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy..", "lineItems": [ { "quantity": "1", "taxPercentage": "2100", "description": "Shoes", "id": "Item #1", "amountIncludingTax": "400", "productUrl": "URL_TO_PURCHASED_ITEM", "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM" }, { "quantity": "2", "taxPercentage": "2100", "description": "Socks", "id": "Item #2", "amountIncludingTax": "300", "productUrl": "URL_TO_PURCHASED_ITEM", "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM" } ] } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v9.1.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'YOUR_X_API_KEY' adyen.env = :test # Set to "live" for live environment request_body = { :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :reference => 'YOUR_ORDER_REFERENCE', :paymentMethod => { :type => 'klarna' }, :amount => { :currency => 'SEK', :value => 1000 }, :shopperLocale => 'en_US', :countryCode => 'SE', :telephoneNumber => '+46 840 839 298', :shopperEmail => 'youremail@email.com', :shopperName => { :firstName => 'Testperson-se', :lastName => 'Approved' }, :shopperReference => 'YOUR_UNIQUE_SHOPPER_ID', :billingAddress => { :city => 'Ankeborg', :country => 'SE', :houseNumberOrName => '1', :postalCode => '12345', :street => 'Stargatan' }, :deliveryAddress => { :city => 'Ankeborg', :country => 'SE', :houseNumberOrName => '1', :postalCode => '12345', :street => 'Stargatan' }, :returnUrl => '', :lineItems => [ { :quantity => '1', :taxPercentage => '2100', :description => 'Shoes', :id => 'Item #1', :amountIncludingTax => '400', :productUrl => 'URL_TO_PURCHASED_ITEM', :imageUrl => 'URL_TO_PICTURE_OF_PURCHASED_ITEM' }, { :quantity => '2', :taxPercentage => '2100', :description => 'Socks', :id => 'Item #2', :amountIncludingTax => '300', :productUrl => 'URL_TO_PURCHASED_ITEM', :imageUrl => 'URL_TO_PICTURE_OF_PURCHASED_ITEM' } ] } result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v18.0.0 // Require the parts of the module you want to use import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const amount: Types.checkout.Amount = { currency: "SEK", value: 1000 }; const lineItem1: Types.checkout.LineItem = { quantity: 1, taxPercentage: 2100, imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM", description: "Shoes", id: "Item #1", amountIncludingTax: 400, productUrl: "URL_TO_PURCHASED_ITEM" }; const lineItem2: Types.checkout.LineItem = { quantity: 2, taxPercentage: 2100, imageUrl: "URL_TO_PICTURE_OF_PURCHASED_ITEM", description: "Socks", id: "Item #2", amountIncludingTax: 300, productUrl: "URL_TO_PURCHASED_ITEM" }; const name: Types.checkout.Name = { firstName: "Testperson-se", lastName: "Approved" }; const deliveryAddress: Types.checkout.DeliveryAddress = { country: "SE", city: "Ankeborg", houseNumberOrName: "1", street: "Stargatan", postalCode: "12345" }; const klarnaDetails: Types.checkout.KlarnaDetails = { type: Types.checkout.KlarnaDetails.TypeEnum.Klarna }; const billingAddress: Types.checkout.BillingAddress = { country: "SE", city: "Ankeborg", houseNumberOrName: "1", street: "Stargatan", postalCode: "12345" }; const paymentRequest: Types.checkout.PaymentRequest = { amount: amount, telephoneNumber: "+46 840 839 298", shopperEmail: "youremail@email.com", reference: "YOUR_ORDER_REFERENCE", lineItems: [lineItem1, lineItem2], shopperName: name, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", deliveryAddress: deliveryAddress, countryCode: "SE", paymentMethod: klarnaDetails, shopperLocale: "en_US", billingAddress: billingAddress, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_UNIQUE_SHOPPER_ID" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` See examples of other Klarna-specific payment scenarios at [Invoice lines and discounts](/payment-methods/klarna/invoice-lines) and [Klarna for airlines](/payment-methods/klarna/airlines/). ## Component configuration ### v5.0.0 or later If your integration uses iOS Components v5.0.0 or later, configure and create an instance of the Klarna Component: ### Tab: /sessions **Component configuration** ```swift let paymentMethods = session.sessionContext.paymentMethods // Check that the payment method is supported before showing the Component. guard let paymentMethod = paymentMethods.paymentMethod(ofType: .other("klarna")) else { return } let component = InstantPaymentComponent(paymentMethod: paymentMethod, context: context, order: nil) self.currentComponent = component // Set the session as the delegate. component.delegate = session component.initiatePayment() ``` ### Tab: Advanced flow **Component configuration** ```swift // Check that the payment method is supported before showing the Component. guard let paymentMethod = paymentMethods.paymentMethod(ofType: .other("klarna")) else { return } let component = InstantPaymentComponent(paymentMethod: paymentMethod, context: context, order: nil) self.currentComponent = component // Set the component as the delegate. component.delegate = self component.initiatePayment() ``` ### v4.x.x If your integration uses an earlier version of iOS Components: **Component configuration** ```swift // Check that the payment method is supported before showing the Component. guard let paymentMethod = paymentMethods.paymentMethod(ofType: KlarnaPaymentMethod.self) else { return } let style = FormComponentStyle() let component = KlarnaComponent(paymentMethod: paymentMethod, apiContext: context, style: style) present(component) ``` There are no configuration steps specific to Klarna required for Components. ## Capture the payment If the [capture delay](/online-payments/capture#delayed-automatic-capture) is set to **immediate** and you comply with Klarna's Scheme Rules of shipping within 24 hours, then you can configure automatic capture when adding Klarna in your live Customer Area. Otherwise, you must **manually capture Klarna payments** within 90 days after authorization, even if you enable automatic capture on your merchant account. If the manual capture is not performed within 90 days, the authorization will expire. ### Capture manually To [manually capture](/online-payments/capture#manual-capture) a Klarna payment, make a POST request to the [/payments/{paymentPspReference}/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) endpoint. 1. When you are ready to capture the payment, make a POST [/payments/{paymentPspReference}/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) request, where `{paymentPspReference}` is the PSP reference from the original payment (pre-authorization) response. Specify: | Parameter | Required | Description | | ----------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `merchantAccount` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The name of your merchant account that is used to process the payment. | | `amount.currency` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The three-character [ISO currency code](/development-resources/currency-codes). | | `amount.value` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The amount of the transaction, in [minor units](/development-resources/currency-codes). This is the sum of the original, pre-authorized amount and all later adjustments. | | `lineItems` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Price and product information about the purchased items, to be included on the invoice sent to the shopper.For an authorization adjustment, always specify every line item, including all captured or refunded items. See examples of Klarna-specific payment scenarios at [Invoice lines and discounts](/payment-methods/klarna/invoice-lines). | | `reference` | | A reference that you specify for this payment modification, for use in your reconciliation process.The `pspReference` you received in the initial authorization response remains the primary merchant reference, and this reference does not overwrite it. | **Klarna capture request** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments/{paymentPspReference}/captures \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "amount": { "currency": "EUR", "value": 21415 }, "lineItems": [ { "quantity": "1", "amountExcludingTax": "12500", "taxPercentage": "2000", "description": "Jacket", "id": "Item #1", "taxAmount": "2500", "amountIncludingTax": "15000" }, { "quantity": "1", "amountExcludingTax": "5346", "taxPercentage": "2000", "description": "Pants", "id": "Item #2", "taxAmount": "1069", "amountIncludingTax": "6415" } ], "reference": "YOUR_UNIQUE_REFERENCE" }' ``` #### Java ```java // Adyen Java API Library v41.1.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the LIVE environment, also include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) LineItem lineItem1 = new LineItem() .quantity(1L) .amountExcludingTax(12500L) .taxPercentage(2000L) .description("Jacket") .id("Item #1") .taxAmount(2500L) .amountIncludingTax(15000L); LineItem lineItem2 = new LineItem() .quantity(1L) .amountExcludingTax(5346L) .taxPercentage(2000L) .description("Pants") .id("Item #2") .taxAmount(1069L) .amountIncludingTax(6415L); Amount amount = new Amount() .currency("EUR") .value(21415L); PaymentCaptureRequest paymentCaptureRequest = new PaymentCaptureRequest() .lineItems(Arrays.asList(lineItem1, lineItem2)) .reference("YOUR_UNIQUE_REFERENCE") .amount(amount) .merchantAccount("ADYEN_MERCHANT_ACCOUNT"); // Send the request ModificationsApi service = new ModificationsApi(client); PaymentCaptureResponse response = service.captureAuthorisedPayment("paymentPspReference", paymentCaptureRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php setXApiKey("ADYEN_API_KEY"); // For the LIVE environment, also include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $lineItem1 = new LineItem(); $lineItem1 ->setQuantity(1) ->setAmountExcludingTax(12500) ->setTaxPercentage(2000) ->setDescription("Jacket") ->setId("Item #1") ->setTaxAmount(2500) ->setAmountIncludingTax(15000); $lineItem2 = new LineItem(); $lineItem2 ->setQuantity(1) ->setAmountExcludingTax(5346) ->setTaxPercentage(2000) ->setDescription("Pants") ->setId("Item #2") ->setTaxAmount(1069) ->setAmountIncludingTax(6415); $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(21415); $paymentCaptureRequest = new PaymentCaptureRequest(); $paymentCaptureRequest ->setLineItems(array($lineItem1, $lineItem2)) ->setReference("YOUR_UNIQUE_REFERENCE") ->setAmount($amount) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new ModificationsApi($client); $response = $service->captureAuthorisedPayment('paymentPspReference', $paymentCaptureRequest, $requestOptions); ``` #### C\# ```cs // Adyen .NET API Library v34.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the LIVE environment, also include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) LineItem lineItem1 = new LineItem { Quantity = 1, AmountExcludingTax = 12500, TaxPercentage = 2000, Description = "Jacket", Id = "Item #1", TaxAmount = 2500, AmountIncludingTax = 15000 }; LineItem lineItem2 = new LineItem { Quantity = 1, AmountExcludingTax = 5346, TaxPercentage = 2000, Description = "Pants", Id = "Item #2", TaxAmount = 1069, AmountIncludingTax = 6415 }; Amount amount = new Amount { Currency = "EUR", Value = 21415 }; PaymentCaptureRequest paymentCaptureRequest = new PaymentCaptureRequest { LineItems = new List{ lineItem1, lineItem2 }, Reference = "YOUR_UNIQUE_REFERENCE", Amount = amount, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT" }; // Send the request var service = new ModificationsService(client); var response = service.CaptureAuthorisedPayment("paymentPspReference", paymentCaptureRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v30.1.0 const { Client, CheckoutAPI } = require('@adyen/api-library'); // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const paymentCaptureRequest = { merchantAccount: "ADYEN_MERCHANT_ACCOUNT", amount: { currency: "EUR", value: 21415 }, lineItems: [ { quantity: "1", amountExcludingTax: "12500", taxPercentage: "2000", description: "Jacket", id: "Item #1", taxAmount: "2500", amountIncludingTax: "15000" }, { quantity: "1", amountExcludingTax: "5346", taxPercentage: "2000", description: "Pants", id: "Item #2", taxAmount: "1069", amountIncludingTax: "6415" } ], reference: "YOUR_UNIQUE_REFERENCE" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.ModificationsApi.captureAuthorisedPayment("paymentPspReference", paymentCaptureRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.2.0 import ( "context" "github.com/adyen/adyen-go-api-library/v21/src/common" "github.com/adyen/adyen-go-api-library/v21/src/adyen" "github.com/adyen/adyen-go-api-library/v21/src/checkout" ) // For the LIVE environment, also include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) lineItem1 := checkout.LineItem{ Quantity: common.PtrInt64(1), AmountExcludingTax: common.PtrInt64(12500), TaxPercentage: common.PtrInt64(2000), Description: common.PtrString("Jacket"), Id: common.PtrString("Item #1"), TaxAmount: common.PtrInt64(2500), AmountIncludingTax: common.PtrInt64(15000), } lineItem2 := checkout.LineItem{ Quantity: common.PtrInt64(1), AmountExcludingTax: common.PtrInt64(5346), TaxPercentage: common.PtrInt64(2000), Description: common.PtrString("Pants"), Id: common.PtrString("Item #2"), TaxAmount: common.PtrInt64(1069), AmountIncludingTax: common.PtrInt64(6415), } amount := checkout.Amount{ Currency: "EUR", Value: 21415, } paymentCaptureRequest := checkout.PaymentCaptureRequest{ LineItems: []checkout.LineItem{ lineItem1, lineItem2, }, Reference: common.PtrString("YOUR_UNIQUE_REFERENCE"), Amount: amount, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", } // Send the request service := client.Checkout() req := service.ModificationsApi.CaptureAuthorisedPaymentInput("paymentPspReference").IdempotencyKey("UUID").PaymentCaptureRequest(paymentCaptureRequest) res, httpRes, err := service.ModificationsApi.CaptureAuthorisedPayment(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v14.0.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "amount": { "currency": "EUR", "value": 21415 }, "lineItems": [ { "quantity": "1", "amountExcludingTax": "12500", "taxPercentage": "2000", "description": "Jacket", "id": "Item #1", "taxAmount": "2500", "amountIncludingTax": "15000" }, { "quantity": "1", "amountExcludingTax": "5346", "taxPercentage": "2000", "description": "Pants", "id": "Item #2", "taxAmount": "1069", "amountIncludingTax": "6415" } ], "reference": "YOUR_UNIQUE_REFERENCE" } # Send the request result = adyen.checkout.modifications_api.capture_authorised_payment(request=json_request, paymentPspReference="paymentPspReference", idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v11.2.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT', :amount => { :currency => 'EUR', :value => 21415 }, :lineItems => [ { :quantity => '1', :amountExcludingTax => '12500', :taxPercentage => '2000', :description => 'Jacket', :id => 'Item #1', :taxAmount => '2500', :amountIncludingTax => '15000' }, { :quantity => '1', :amountExcludingTax => '5346', :taxPercentage => '2000', :description => 'Pants', :id => 'Item #2', :taxAmount => '1069', :amountIncludingTax => '6415' } ], :reference => 'YOUR_UNIQUE_REFERENCE' } # Send the request result = adyen.checkout.modifications_api.capture_authorised_payment(request_body, 'paymentPspReference', headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v30.1.0 import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const lineItem1: Types.checkout.LineItem = { quantity: 1, amountExcludingTax: 12500, taxPercentage: 2000, description: "Jacket", id: "Item #1", taxAmount: 2500, amountIncludingTax: 15000 }; const lineItem2: Types.checkout.LineItem = { quantity: 1, amountExcludingTax: 5346, taxPercentage: 2000, description: "Pants", id: "Item #2", taxAmount: 1069, amountIncludingTax: 6415 }; const amount: Types.checkout.Amount = { currency: "EUR", value: 21415 }; const paymentCaptureRequest: Types.checkout.PaymentCaptureRequest = { lineItems: [lineItem1, lineItem2], reference: "YOUR_UNIQUE_REFERENCE", amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.ModificationsApi.captureAuthorisedPayment("paymentPspReference", paymentCaptureRequest, { idempotencyKey: "UUID" }); ``` 2. When you receive the [/payments/{paymentPspReference}/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) response, note the following: * `pspReference`: The PSP reference associated with this `/captures` request.\ This is different from the PSP reference associated with the original payment (pre-authorization) request. * `status`: **received** * `reference`: Your reference to this payment modification, for use in your reconciliation process. **/captures response** ```json { "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "paymentPspReference": "KHQC5N7G84BLNK43", "pspReference": "QJ7GWQ756L2GWR86", "reference": "YOUR_UNIQUE_REFERENCE", "status": "received", "amount": { "currency": "EUR", "value": 21415 } } ``` 3. Wait for the [webhook event](/development-resources/webhooks). This informs you whether the final amount has been captured.\ If the capture is successful, this event contains: * `eventCode`: **CAPTURE** * `originalReference`: The `pspReference` of the pre-authorization. * `pspReference`: The PSP reference associated with this [/payments/{paymentPspReference}/captures](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/\(paymentPspReference\)/captures) request. * `success`: **true** If the capture fails, this event contains `success`: **false**. Review the `reason` you received in the webhook event, fix the issue, and submit the capture request again. See examples of other Klarna-specific payment scenarios at [Invoice lines and discounts](/payment-methods/klarna/invoice-lines). #### Shipping and tracking information (optional) You can optionally use `additionalData.openinvoicedata` to include shipping and tracking information. This adds information about how the products are shipped to the `deliveryAddress` that you specified in the /payments request. The shipping and tracking information maps to [Klarna's shipping info](https://docs.klarna.com/api/ordermanagement/#operation/appendOrderShippingInfo) object. If you have the shipping and tracking information at the time of the capture, we recommend that you send it to improve the overall shopper experience. Klarna includes this information in their app, where the info is updated based on the tracking details. * If all items are shipped with the same provider, specify the shipping and tracking information once, as shown in the capture example below. * If one or more items in the order are shipped with different a different provider or tracking details, specify the shipping and tracking information as an array. * You cannot specify different delivery addresses for a single order with multiple items. | openinvoicedata | Corresponds with Klarna's [`shipping_info` ](https://docs.klarna.com/api/ordermanagement/#operation/appendOrderShippingInfo)object | Description | | | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | | `shippingCompany` | `shipping_company` | The name of the shipping company, as specific as possible. Maximum 100 characters. If there are multiple shipping companies, specify an array. For example: **DHL SE** or **\[DHL SE, PostNord]** | | | `shippingMethod` | `shipping_method` | Shipping method. Possible values:* **PickUpStore** * **Home** * **BoxReg** * **BoxUnreg** * **PickUpPoint** * **Own** * **Postal** * **DHLPackstation** * **Digital** * **Undefined** | | | `trackingNumber` | `tracking_number` | Tracking number for the shipment. Maximum 100 characters. If there are multiple tracking numbers, specify an array. For example: **050823** or **\[050823, 050824]** | | | `trackingUri` | `tracking_uri` | URI where the customer can track their shipment. Maximum 1024 characters. | | | `returnShippingCompany` | `return_shipping_company` | The name of the shipping company for the return shipment, as specific as possible. Maximum 100 characters. For example: **DHL SE** | | | `returnTrackingNumber` | `return_tracking_number` | Tracking number for the return shipment. Maximum 100 characters. | | | `returnTrackingUri` | `return_tracking_uri` | URI where the customer can track their return shipment. Maximum 1024 characters. | | **/capture request** ```json { "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "modificationAmount":{ "currency":"SEK", "value":"1000" }, "originalReference":"COPY_PSP_REFERENCE_FROM_AUTHORISE_RESPONSE", "additionalData":{ "openinvoicedata.numberOfLines":"2", "openinvoicedata.line1.currencyCode":"SEK", "openinvoicedata.line1.description":"Shoes", "openinvoicedata.line1.itemAmount":"331", "openinvoicedata.line1.itemVatAmount":"69", "openinvoicedata.line1.itemVatPercentage":"2100", "openinvoicedata.line1.numberOfItems":"1", "openinvoicedata.line1.productUrl":"URL_TO_PURCHASED_ITEM", "openinvoicedata.line1.imageUrl":"URL_TO_PICTURE_OF_PURCHASED_ITEM", "openinvoicedata.line1.shippingCompany": "DHL SE", "openinvoicedata.line1.shippingMethod": "Home", "openinvoicedata.line1.trackingNumber": "TRACKING_NUMBER", "openinvoicedata.line1.trackingUri": "TRACKING_URI", "openinvoicedata.line1.returnShippingCompany": "DHL SE", "openinvoicedata.line1.returnTrackingNumber": "RETURN_TRACKING_NUMBER", "openinvoicedata.line1.returnTrackingUri": "RETURN_TRACKING_URI", "openinvoicedata.line2.currencyCode":"SEK", "openinvoicedata.line2.description":"Socks", "openinvoicedata.line2.itemAmount":"248", "openinvoicedata.line2.itemVatAmount":"52", "openinvoicedata.line2.itemVatPercentage":"2100", "openinvoicedata.line2.numberOfItems":"2", "openinvoicedata.line2.productUrl":"URL_TO_PURCHASED_ITEM", "openinvoicedata.line2.imageUrl":"URL_TO_PICTURE_OF_PURCHASED_ITEM" }, "reference":"YOUR_CAPTURE_REFERENCE" } ``` You will receive a [/capture](https://docs.adyen.com/api-explorer/#/Payment/capture) response containing a `pspReference` associated with this request. Once we have processed your request, you will also receive a CAPTURE [webhook](/development-resources/webhooks). For more information, refer to [Capture](/online-payments/capture). ### Partial captures To [partially capture](/online-payments/capture) a Klarna payment, specify in your call to the [/capture](https://docs.adyen.com/api-explorer/#/Payment/capture) endpoint: * `modificationAmount`: The amount that the shopper should pay. This should be **less than** the authorised amount. * `additionalData.openinvoicedata`: Price, product and optionally shipping and tracking information for the items that the shopper should pay for, to be included on the invoice. For the partial capture to be successful, the amounts stated in `openinvoicedata` need to be correct. You can use the same fields as listed in the [manual captures](#manual-captures) section. For more information and an example, refer to [Invoice lines](/payment-methods/klarna/invoice-lines). ## Recurring payments To make recurring Klarna payments you need to: 1. [Create a shopper token](#create-a-token). 2. [Use the token to make future payments for the shopper](#make-payment-with-token). ### Create a token To create a token, include in your [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request: * `storePaymentMethod`: **true** * [shopperReference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperReference): Your unique identifier for the shopper. When the payment has been settled, you receive a [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created) [webhook](/development-resources/webhooks) containing: * `type`: **recurring.token.created** * `shopperReference`: your unique identifier for the shopper. * `eventId`: the `pspReference` of the initial payment. * `storedPaymentMethodId`: the token that you need to make recurring payments for this shopper. Make sure that your server is able to receive the [Recurring tokens life cycle events](/development-resources/webhooks/webhook-types/#other-webhooks) webhook. You can [set up this webhook in your Customer Area](/development-resources/webhooks/#set-up-webhooks-in-your-customer-area). ### Make a payment with a token To make a payment with the token, include in your [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request: * `shopperReference`: The unique shopper identifier that you specified when creating the token. * `paymentMethod.storedPaymentMethodId`: The `storedPaymentMethodId` from the [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created) webhook.\ You can also get this value by using the [/listRecurringDetails](https://docs.adyen.com/api-explorer/#/Recurring/latest/listRecurringDetails) endpoint. * `shopperInteraction`: **ContAuth** * `recurringProcessingModel`: The type of recurring payment that you want to make.\ Possible `recurringProcessingModel` values: | `recurringProcessingModel` | Description | | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **CardOnFile** | Online purchase where shopper is actively making a purchase using their previously stored payment details. | | **Subscription** | A series of transactions with fixed or variable amounts, following a fixed time interval. This is the default value for payment requests where `shopperInteraction`: **ContAuth** | | **UnscheduledCardOnFile** | Contracts that occur on a non-fixed schedule using stored payment details. For example, automatic top-ups when cardholder's balance drops below certain amount. | When making a recurring payment, you also need to provide all the parameters required for a Klarna [payment request](#make-payment-with-token). The following is a sample request for **Klarna Pay Now**, when the shopper is actively making a purchase using previously stored payment details: **/payments request** ```json { "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "reference":"YOUR_ORDER_REFERENCE", "paymentMethod":{ "type":"klarna_paynow", "{hint:The storedPaymentMethodId from the recurring.token.created webhook}storedPaymentMethodId{/hint}":"8315748692943051" }, "{hint:The shopperReference that you specified when creating the token}shopperReference{/hint}":"YOUR_UNIQUE_SHOPPER_ID", "amount":{ "currency":"SEK", "value":"1000" }, "shopperInteraction":"ContAuth", "recurringProcessingModel": "CardOnFile", "shopperLocale":"en_US", "countryCode":"SE", "telephoneNumber": "+46 840 839 298", "shopperEmail":"youremail@email.com", "shopperName":{ "firstName":"Testperson-se", "lastName":"Approved" }, "billingAddress":{ "city":"Ankeborg", "country":"SE", "houseNumberOrName":"1", "postalCode":"12345", "street":"Stargatan" }, "deliveryAddress":{ "city":"Ankeborg", "country":"SE", "houseNumberOrName":"1", "postalCode":"12345", "street":"Stargatan" }, "returnUrl":"https://your-company.example.com/checkout?shopperOrder=12xy..", "lineItems":[ { "quantity":"1", "amountExcludingTax":"331", "taxPercentage":"2100", "description":"Shoes", "id":"Item #1", "taxAmount":"69", "amountIncludingTax":"400", "productUrl": "URL_TO_PURCHASED_ITEM", "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM" }, { "quantity":"2", "amountExcludingTax":"248", "taxPercentage":"2100", "description":"Socks", "id":"Item #2", "taxAmount":"52", "amountIncludingTax":"300", "productUrl": "URL_TO_PURCHASED_ITEM", "imageUrl": "URL_TO_PICTURE_OF_PURCHASED_ITEM" } ] } ``` ## Test and go live Before accepting live payments, test your integration using the [test environment and sample data provided by Klarna](https://docs.klarna.com/resources/test-environment/). You can then check the status of Klarna test payments in your [Customer Area](https://ca-test.adyen.com/) > **Transactions** > **Payments**. ### Before you go live Make sure that: * You have [added Klarna](/payment-methods/add-payment-methods) in your [live Customer Area](https://ca-live.adyen.com/). * You have considered [Klarna's legal and privacy information](https://docs.klarna.com/resources/legal-and-compliance/payment-solutions-guidelines/eu/). * You follow the [Klarna guidelines](https://docs.klarna.com/resources/marketing-tools/global-marketing-assets/brand-guidelines/) on how to present Klarna in your checkout. * The [invoice lines](/payment-methods/klarna/invoice-lines) and VAT are shown correctly on Klarna's pages. * If a shopper gets rejected by Klarna, you offer them another payment method. * You pass the shopper's name and address in your payment request. This is optional, but providing these parameters improves the shopper experience and increases conversion rates. ### Testing in live environment When testing Klarna payments in the live environment, make sure that you: * Provide real shopper data. For example, your real name, personal email, personal mobile, and home and billing address. Do not provide a company address as billing address. * Choose an item with a reasonable amount that meets Klarna's minimum requirements. For example, for Pay over time, Klarna requires a minimum amount of GBP 1. Klarna can reject a request if the product is too expensive and they do not have enough transaction history for the shopper. * Do not do multiple tests in a short period from the same device or IP address. Otherwise, velocity rule checks are triggered, which will lead to the transaction being rejected. If the conditions above are not met, you can receive a `resultCode` of **Refused**. The shopper sees a page with an "Option Not Available" message instead of the Klarna Payments widget. Note that these checks are bypassed in test and are only applied in the live environment. See [Klarna raw acquirer responses](/payment-methods/klarna/raw-responses) for the most common responses for successful, refused, failed, or cancelled transactions. ## See also * [iOS Components integration guide](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Components) * [Webhooks](/development-resources/webhooks) * [API Explorer](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/overview)