--- title: "Klarna Debit Risk for API only" description: "Add Klarna Debit Risk to your API-only integration." url: "https://docs.adyen.com/payment-methods/klarna-debit-risk/api-only" source_url: "https://docs.adyen.com/payment-methods/klarna-debit-risk/api-only.md" canonical: "https://docs.adyen.com/payment-methods/klarna-debit-risk/api-only" last_modified: "2026-05-08T17:09:18+02:00" language: "en" --- # Klarna Debit Risk for API only Add Klarna Debit Risk to your API-only integration. You can add Klarna Debit Risk to your existing integration. The following instructions show only what you must add to your integration specifically for Klarna Debit Risk. If an instruction on this page corresponds with a step in the main integration guide, it includes a link to corresponding step of the main integration guide. ## Requirements | Requirement | Description | | | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | | **Integration type** | Make sure that you have an existing [API-only integration](/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only). | | | **Redirect handling** | Make sure that your existing integration is set up to [handle the redirect](/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only#handle-the-redirect). `action.type`: **redirect**. | | | **Setup steps** | Before you begin, [add Klarna Debit Risk in your Customer Area](/payment-methods/add-payment-methods). | | ## How it works 1. The shopper selects Klarna Debit Risk as the payment method. 2. The shopper enters their details in the [payment form that you build](#build-your-payment-form). (No details are required for this payment method.) 3. When you make the payment request, you [include additional information about the shopper](#additional-parameters-payments). 4. Your existing integration setup will [handle the redirect](/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only#handle-the-redirect). ## Build your payment form Include Klarna Debit Risk in the list of available payment methods. There are no additional fields that you have to include in your form. However, make sure to pass the correct [country code](#available-payment-methods) of the shopper. You can [download the logo for Klarna Debit Risk](/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%2Bonly\&version=71#downloading-logos) to use in your form. ## Get Klarna Debit Risk as an available payment method When you make the [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) to [get available payment methods](/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only#get-available-payment-methods), specify the following so that Klarna Debit Risk is included in the response. | Parameter | Values | | ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------- | | [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-countryCode) | **AT**, **BE**, **DE**, **NL**, **ES**, **CH** | | [amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-amount-currency) | **EUR**, **CHF** | **Example request for available payment methods** #### curl ```bash curl https://checkout-test.adyen.com/v72/paymentMethods \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'idempotency-key: YOUR_IDEMPOTENCY_KEY' \ -H 'content-type: application/json' \ -X POST -d '{ "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "countryCode": "DE", "amount": { "currency": "EUR", "value": 1000 }, "shopperLocale": "de-DE" }' ``` #### Java ```java // Adyen Java API Library v40.0.1 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) Amount amount = new Amount() .currency("EUR") .value(1000L); PaymentMethodsRequest paymentMethodsRequest = new PaymentMethodsRequest() .amount(amount) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .countryCode("DE") .shopperLocale("de-DE"); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentMethodsResponse response = service.paymentMethods(paymentMethodsRequest, 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) $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(1000); $paymentMethodsRequest = new PaymentMethodsRequest(); $paymentMethodsRequest ->setAmount($amount) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setCountryCode("DE") ->setShopperLocale("de-DE"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->paymentMethods($paymentMethodsRequest, $requestOptions); ``` #### C\# ```cs // Adyen .NET API Library v32.2.1 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) Amount amount = new Amount { Currency = "EUR", Value = 1000 }; PaymentMethodsRequest paymentMethodsRequest = new PaymentMethodsRequest { Amount = amount, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", CountryCode = "DE", ShopperLocale = "de-DE" }; // Send the request var service = new PaymentsService(client); var response = service.PaymentMethods(paymentMethodsRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v30.0.1 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 paymentMethodsRequest = { merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "DE", amount: { currency: "EUR", value: 1000 }, shopperLocale: "de-DE" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.paymentMethods(paymentMethodsRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.1.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) amount := checkout.Amount{ Currency: "EUR", Value: 1000, } paymentMethodsRequest := checkout.PaymentMethodsRequest{ Amount: &amount, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", CountryCode: common.PtrString("DE"), ShopperLocale: common.PtrString("de-DE"), } // Send the request service := client.Checkout() req := service.PaymentsApi.PaymentMethodsInput().IdempotencyKey("UUID").PaymentMethodsRequest(paymentMethodsRequest) res, httpRes, err := service.PaymentsApi.PaymentMethods(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", "countryCode": "DE", "amount": { "currency": "EUR", "value": 1000 }, "shopperLocale": "de-DE" } # Send the request result = adyen.checkout.payments_api.payment_methods(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v11.1.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', :countryCode => 'DE', :amount => { :currency => 'EUR', :value => 1000 }, :shopperLocale => 'de-DE' } # Send the request result = adyen.checkout.payments_api.payment_methods(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v30.0.1 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 amount: Types.checkout.Amount = { currency: "EUR", value: 1000 }; const paymentMethodsRequest: Types.checkout.PaymentMethodsRequest = { amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "DE", shopperLocale: "de-DE" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.paymentMethods(paymentMethodsRequest, { idempotencyKey: "UUID" }); ``` **Example response with Klarna Debit Risk available** ```json { "paymentMethods": [ { "{hint:In the Netherlands Klarna Debit Risk is called Online overschrijving}name{/hint}": "Klarna Debit Risk", "type": "directEbanking" } ] } ``` ## Add additional parameters to your /payments request You do not need to add any additional parameters when you [make a payment](/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only#make-a-payment), but make sure to include the following parameters: | Parameter | Required | Description | | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `paymentMethod.type` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to **directEbanking**. | | [returnUrl](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-returnUrl) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | URL to where the shopper should be redirected back to after they complete the payment. | | [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/region in a two-letter country code format. Include this in the request to make sure the shopper can proceed in the Klarna flow. | | [shopperLocale](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperLocale) | | The language that the Klarna Debit Risk page should be rendered in. The page can be the local language (for example, nl-NL for the Netherlands) or in en-US. | | [shopperEmail](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperEmail) | | The email of the shopper. If included, Klarna will pre-fill it if the shopper does not have a Klarna account yet and needs to create one. | | [telephoneNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-telephoneNumber) | | The phone number of the shopper. If included, Klarna will pre-fill it in the Klarna log-in screen. | The following example shows how to make a payment request for 10 EUR for a shopper in Germany, with the Klarna Debit Risk page rendered in German. **Example payment request for Klarna Debit Risk** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-API-key: ADYEN_API_KEY' \ -H 'idempotency-key: YOUR_IDEMPOTENCY_KEY' \ -H 'content-type: application/json' \ -X POST -d '{ "amount":{ "currency":"EUR", "value":1000 }, "paymentMethod":{ "type":"directEbanking" }, "reference":"YOUR_ORDER_NUMBER", "returnUrl":"https://your-company.com/checkout?shopperOrder=12xy..", "merchantAccount":"ADYEN_MERCHANT_ACCOUNT", "countryCode": "DE", "shopperLocale": "de-DE" }' ``` #### Java ```java // Adyen Java API Library v40.0.1 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) Amount amount = new Amount() .currency("EUR") .value(1000L); PaymentDetails paymentDetails = new PaymentDetails() .type(PaymentDetails.TypeEnum.DIRECTEBANKING); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_ORDER_NUMBER") .amount(amount) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .countryCode("DE") .paymentMethod(new CheckoutPaymentMethod(paymentDetails)) .shopperLocale("de-DE") .returnUrl("https://your-company.com/checkout?shopperOrder=12xy.."); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentResponse response = service.payments(paymentRequest, 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) $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(1000); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setType("directEbanking"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_ORDER_NUMBER") ->setAmount($amount) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setCountryCode("DE") ->setPaymentMethod($checkoutPaymentMethod) ->setShopperLocale("de-DE") ->setReturnUrl("https://your-company.com/checkout?shopperOrder=12xy.."); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .NET API Library v32.2.1 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) Amount amount = new Amount { Currency = "EUR", Value = 1000 }; PaymentDetails paymentDetails = new PaymentDetails { Type = PaymentDetails.TypeEnum.DirectEbanking }; PaymentRequest paymentRequest = new PaymentRequest { Reference = "YOUR_ORDER_NUMBER", Amount = amount, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", CountryCode = "DE", PaymentMethod = new CheckoutPaymentMethod(paymentDetails), ShopperLocale = "de-DE", ReturnUrl = "https://your-company.com/checkout?shopperOrder=12xy.." }; // 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 v30.0.1 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 paymentRequest = { amount: { currency: "EUR", value: 1000 }, paymentMethod: { type: "directEbanking" }, reference: "YOUR_ORDER_NUMBER", returnUrl: "https://your-company.com/checkout?shopperOrder=12xy..", merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "DE", shopperLocale: "de-DE" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.1.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) amount := checkout.Amount{ Currency: "EUR", Value: 1000, } paymentDetails := checkout.PaymentDetails{ Type: common.PtrString("directEbanking"), } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_ORDER_NUMBER", Amount: amount, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", CountryCode: common.PtrString("DE"), PaymentMethod: checkout.PaymentDetailsAsCheckoutPaymentMethod(&paymentDetails), ShopperLocale: common.PtrString("de-DE"), ReturnUrl: "https://your-company.com/checkout?shopperOrder=12xy..", } // 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 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 = { "amount": { "currency": "EUR", "value": 1000 }, "paymentMethod": { "type": "directEbanking" }, "reference": "YOUR_ORDER_NUMBER", "returnUrl": "https://your-company.com/checkout?shopperOrder=12xy..", "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "countryCode": "DE", "shopperLocale": "de-DE" } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v11.1.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 = { :amount => { :currency => 'EUR', :value => 1000 }, :paymentMethod => { :type => 'directEbanking' }, :reference => 'YOUR_ORDER_NUMBER', :returnUrl => 'https://your-company.com/checkout?shopperOrder=12xy..', :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT', :countryCode => 'DE', :shopperLocale => 'de-DE' } # Send the request result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v30.0.1 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 amount: Types.checkout.Amount = { currency: "EUR", value: 1000 }; const paymentDetails: Types.checkout.PaymentDetails = { type: Types.checkout.PaymentDetails.TypeEnum.DirectEbanking }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_ORDER_NUMBER", amount: amount, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", countryCode: "DE", paymentMethod: paymentDetails, shopperLocale: "de-DE", returnUrl: "https://your-company.com/checkout?shopperOrder=12xy.." }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` The response includes the `action.type`: **redirect**. **Example response with an additional action** ```json { "resultCode":"RedirectShopper", "action":{ "paymentMethodType":"directEbanking", "method":"GET", "url":"https://checkoutshopper-test.adyen.com/checkoutshopper/checkoutPaymentRedirect?redirectData=...", "type":"redirect" } } ``` ## Handle the redirect 1. To complete the payment, redirect the shopper to the `action.url` returned in the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response, taking into account the following recommendations: * When using the HTTP GET method:\ For security reasons, when showing the redirect in the app, we recommend that you use [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) for iOS or [Chrome Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) for Android, instead of WebView objects. Also refer to the [security best practices](https://developer.android.com/topic/security/best-practices#webview) for WebView. * Redirection for mobile integrations:\ For mobile integrations, we strongly recommended that you redirect the shopper to the default browser of their device. Redirecting to the default browser ensures the best compatibility, handling of multi-factor authentication, app-to-app redirection, and error handling. 2. After the shopper is redirected back to your website, check the payment result by making a POST [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details) request, specifying: * `details`: object that contains the URL-decoded `redirectResult` returned when the shopper was redirected back to your site. **/payments/details request** ```json curl https://checkout-test.adyen.com/v68/payments/details \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "details": { "redirectResult": "eyJ0cmFuc1N0YXR1cyI6IlkifQ==" } }' ``` You receive a `/payments/details` response containing: * `resultCode`: Use this to present the result to your shopper. * `pspReference`: Our unique identifier for the transaction. **/payments/details response** ```json { "resultCode": "Authorised", "pspReference": "V4HZ4RBFJGXXGN82" } ``` ## Show the payment result Use the [resultCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details#responses-200-resultCode) that you received in the [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details) response to present the payment result to your shopper. The `resultCode` values you can receive for Klarna Debit Risk are: | resultCode | Description | Action to take | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Authorised** | The shopper completed their payment, and it has been sent to the bank for processing. In most cases, this means that you will receive the funds. | Inform the shopper that the payment has been successful. | | **Cancelled** | The shopper cancelled the payment while on their bank's website. | Ask the shopper whether they want to continue with the order, or ask them to select a different payment method. | | **Error** | There was an error when the payment was being processed. | Inform the shopper that there was an error processing their payment. The response contains a `refusalReason`, indicating the cause of the error. | | **Pending** or **Received** | The shopper has completed the payment but the final result is not yet known. | Inform the shopper that you have received their order, and are waiting for the payment to be completed. You will receive the final result of the payment in an [AUTHORISATION webhook](/development-resources/webhooks/webhook-types). | | **Refused** | The payment was refused by the shopper's bank. | Ask the shopper to try the payment again using a different payment method. | []()If the shopper failed to return to your website or app, wait for webhooks to know the outcome of the payment: | eventCode | success field | Description | Action to take | | ----------------- | ------------- | ----------------------------------------------- | ----------------------------------------------------------------------------------- | | **AUTHORISATION** | **false** | The transaction failed. | Cancel the order and inform the shopper that the payment failed. | | **AUTHORISATION** | **true** | The shopper successfully completed the payment. | Inform the shopper that the payment has been successful and proceed with the order. | ## Recurring payments We support recurring transactions for Klarna Debit Risk through [SEPA Direct Debit](https://docs.adyen.com/payment-methods/sepa-direct-debit). To make recurring 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). We strongly recommend that you request explicit permission from the shopper if you intend to make recurring SEPA payments. Being transparent about the payment schedule and the charged amount reduces the risk of chargebacks. ### Create a token #### Store SEPA details using a Klarna Debit Risk payment When [creating a token](/online-payments/tokenization/create-tokens) with a Klarna Debit Risk payment, use the standard tokenization parameters in your payment request. You do not need to include any additional parameters. Include the following parameters in your [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request: | Parameter | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `paymentMethod.type` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to **directEbanking**. | | [returnUrl](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-returnUrl) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | URL to where the shopper should be redirected back to after they complete the payment. | | [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/region in a two-letter country code format. Include this in the request to make sure the shopper can proceed in the Klarna flow. | | [shopperLocale](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperLocale) | | The language that the Klarna Debit Risk page should be rendered in. The page can be the local language (for example, nl-NL for the Netherlands) or in en-US. | | [shopperEmail](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperEmail) | | The email of the shopper. If included, Klarna will pre-fill it if the shopper does not have a Klarna account yet and needs to create one. | | [telephoneNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-telephoneNumber) | | The phone number of the shopper. If included, Klarna will pre-fill it in the Klarna log-in screen. | | [recurringProcessingModel](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-recurringProcessingModel) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The type of recurring payment the token is intended for. If you want to use the token for more than one type of recurring payment, use the type that is most appropriate at the time of token creation. In subsequent transactions, you can specify another `recurringProcessingModel`. Possible values: **UnscheduledCardOnFile**: A transaction that occurs on a non-fixed schedule and/or have variable amounts. **Subscription**: A transaction for a fixed or variable amount, which follows a fixed schedule. **CardOnFile**: A transaction where bank account details are stored to enable one-click or omnichannel journeys, or to offer a faster checkout later. Because of the chargeback risks associated with SEPA Direct Debit, it is not recommended to use SEPA Direct Debit for CardOnFile flows. Because the user is present, it is recommended to let the user authorize individual payments with Klarna Debit Risk. | | [shopperInteraction](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperInteraction) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Indicates the sales channel through which the shopper authorizes the payment. For online transactions, this is **Ecommerce**. | | [shopperReference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperReference) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique reference for the shopper. Do not include personally identifiable information (PII), such as name or email address. Format: - Minimum length: 3 characters. - Case-sensitive. | | [storePaymentMethod](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-storePaymentMethod) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | When you first create a token, set to **true** to store the shopper's payment details. For subsequent payments, this parameter is not required. | **Create a Klarna Debit Risk token for subscription payments** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "amount":{ "value":1000, "currency":"EUR" }, "paymentMethod":{ "type":"directEbanking" }, "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "reference":"YOUR_ORDER_NUMBER", "recurringProcessingModel": "Subscription", "returnUrl":"https://your-company.com/checkout?shopperOrder=12xy..", "shopperReference":"YOUR_SHOPPER_REFERENCE", "shopperInteraction":"ContAuth", "storePaymentMethod": "true" }' ``` #### Java ```java // Adyen Java API Library v41.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, also include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) Amount amount = new Amount() .currency("EUR") .value(1000L); PaymentDetails paymentDetails = new PaymentDetails() .type(PaymentDetails.TypeEnum.DIRECTEBANKING); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_ORDER_NUMBER") .amount(amount) .storePaymentMethod(true) .merchantAccount("YOUR_MERCHANT_ACCOUNT") .recurringProcessingModel(PaymentRequest.RecurringProcessingModelEnum.SUBSCRIPTION) .paymentMethod(new CheckoutPaymentMethod(paymentDetails)) .shopperInteraction(PaymentRequest.ShopperInteractionEnum.CONTAUTH) .returnUrl("https://your-company.com/checkout?shopperOrder=12xy..") .shopperReference("YOUR_SHOPPER_REFERENCE"); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentResponse response = service.payments(paymentRequest, 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) $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(1000); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setType("directEbanking"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_ORDER_NUMBER") ->setAmount($amount) ->setStorePaymentMethod(true) ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT") ->setRecurringProcessingModel("Subscription") ->setPaymentMethod($checkoutPaymentMethod) ->setShopperInteraction("ContAuth") ->setReturnUrl("https://your-company.com/checkout?shopperOrder=12xy..") ->setShopperReference("YOUR_SHOPPER_REFERENCE"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v33.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) Amount amount = new Amount { Currency = "EUR", Value = 1000 }; PaymentDetails paymentDetails = new PaymentDetails { Type = PaymentDetails.TypeEnum.DirectEbanking }; PaymentRequest paymentRequest = new PaymentRequest { Reference = "YOUR_ORDER_NUMBER", Amount = amount, StorePaymentMethod = true, MerchantAccount = "YOUR_MERCHANT_ACCOUNT", RecurringProcessingModel = PaymentRequest.RecurringProcessingModelEnum.Subscription, PaymentMethod = new CheckoutPaymentMethod(paymentDetails), ShopperInteraction = PaymentRequest.ShopperInteractionEnum.ContAuth, ReturnUrl = "https://your-company.com/checkout?shopperOrder=12xy..", ShopperReference = "YOUR_SHOPPER_REFERENCE" }; // 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 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 paymentRequest = { amount: { value: 1000, currency: "EUR" }, paymentMethod: { type: "directEbanking" }, merchantAccount: "YOUR_MERCHANT_ACCOUNT", reference: "YOUR_ORDER_NUMBER", recurringProcessingModel: "Subscription", returnUrl: "https://your-company.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_SHOPPER_REFERENCE", shopperInteraction: "ContAuth", storePaymentMethod: "true" } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.1.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) amount := checkout.Amount{ Currency: "EUR", Value: 1000, } paymentDetails := checkout.PaymentDetails{ Type: common.PtrString("directEbanking"), } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_ORDER_NUMBER", Amount: amount, StorePaymentMethod: common.PtrBool(true), MerchantAccount: "YOUR_MERCHANT_ACCOUNT", RecurringProcessingModel: common.PtrString("Subscription"), PaymentMethod: checkout.PaymentDetailsAsCheckoutPaymentMethod(&paymentDetails), ShopperInteraction: common.PtrString("ContAuth"), ReturnUrl: "https://your-company.com/checkout?shopperOrder=12xy..", ShopperReference: common.PtrString("YOUR_SHOPPER_REFERENCE"), } // 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 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 = { "amount": { "value": 1000, "currency": "EUR" }, "paymentMethod": { "type": "directEbanking" }, "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "reference": "YOUR_ORDER_NUMBER", "recurringProcessingModel": "Subscription", "returnUrl": "https://your-company.com/checkout?shopperOrder=12xy..", "shopperReference": "YOUR_SHOPPER_REFERENCE", "shopperInteraction": "ContAuth", "storePaymentMethod": "True" } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v11.1.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 = { :amount => { :value => 1000, :currency => 'EUR' }, :paymentMethod => { :type => 'directEbanking' }, :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :reference => 'YOUR_ORDER_NUMBER', :recurringProcessingModel => 'Subscription', :returnUrl => 'https://your-company.com/checkout?shopperOrder=12xy..', :shopperReference => 'YOUR_SHOPPER_REFERENCE', :shopperInteraction => 'ContAuth', :storePaymentMethod => 'true' } # Send the request result = adyen.checkout.payments_api.payments(request_body, 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 amount: Types.checkout.Amount = { currency: "EUR", value: 1000 }; const paymentDetails: Types.checkout.PaymentDetails = { type: Types.checkout.PaymentDetails.TypeEnum.DirectEbanking }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_ORDER_NUMBER", amount: amount, storePaymentMethod: true, merchantAccount: "YOUR_MERCHANT_ACCOUNT", recurringProcessingModel: Types.checkout.PaymentRequest.RecurringProcessingModelEnum.Subscription, paymentMethod: paymentDetails, shopperInteraction: Types.checkout.PaymentRequest.ShopperInteractionEnum.ContAuth, returnUrl: "https://your-company.com/checkout?shopperOrder=12xy..", shopperReference: "YOUR_SHOPPER_REFERENCE" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` When a token is created, you receive a [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created) webhook. The webhook contains the `storedPaymentMethodId` that you can use to make subsequent payments using the stored payment details. ### Make a payment with a token Only use tokenised payments in scenarios where the shopper is not present, that is, `UnscheduledCardOnFile` and `Subscription` payments. #### Make a subscription payment [Make a subscription payment](/online-payments/tokenization/make-token-payments#make-a-subscription-or-unscheduled-card-on-file-payment) using the standard tokenization parameters. The payment will be processed as a SEPA Direct Debit payment. You do not need to include any additional parameters. **Make a subscription payment with a SEPA token** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "amount":{ "value":1000, "currency":"EUR" }, "paymentMethod":{ "type":"sepadirectdebit", "storedPaymentMethodId":"7219687191761347" }, "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "reference":"YOUR_ORDER_NUMBER", "shopperReference":"YOUR_SHOPPER_REFERENCE", "shopperInteraction":"ContAuth", "recurringProcessingModel": "Subscription" }' ``` #### Java ```java // Adyen Java API Library v39.3.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) Amount amount = new Amount() .currency("EUR") .value(1000L); SepaDirectDebitDetails sepaDirectDebitDetails = new SepaDirectDebitDetails() .storedPaymentMethodId("7219687191761347") .type(SepaDirectDebitDetails.TypeEnum.SEPADIRECTDEBIT); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_ORDER_NUMBER") .amount(amount) .merchantAccount("YOUR_MERCHANT_ACCOUNT") .recurringProcessingModel(PaymentRequest.RecurringProcessingModelEnum.SUBSCRIPTION) .paymentMethod(new CheckoutPaymentMethod(sepaDirectDebitDetails)) .shopperInteraction(PaymentRequest.ShopperInteractionEnum.CONTAUTH) .shopperReference("YOUR_SHOPPER_REFERENCE"); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentResponse response = service.payments(paymentRequest, 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) $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(1000); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setStoredPaymentMethodId("7219687191761347") ->setType("sepadirectdebit"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_ORDER_NUMBER") ->setAmount($amount) ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT") ->setRecurringProcessingModel("Subscription") ->setPaymentMethod($checkoutPaymentMethod) ->setShopperInteraction("ContAuth") ->setShopperReference("YOUR_SHOPPER_REFERENCE"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v32.1.1 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) Amount amount = new Amount { Currency = "EUR", Value = 1000 }; SepaDirectDebitDetails sepaDirectDebitDetails = new SepaDirectDebitDetails { StoredPaymentMethodId = "7219687191761347", Type = SepaDirectDebitDetails.TypeEnum.Sepadirectdebit }; PaymentRequest paymentRequest = new PaymentRequest { Reference = "YOUR_ORDER_NUMBER", Amount = amount, MerchantAccount = "YOUR_MERCHANT_ACCOUNT", RecurringProcessingModel = PaymentRequest.RecurringProcessingModelEnum.Subscription, PaymentMethod = new CheckoutPaymentMethod(sepaDirectDebitDetails), ShopperInteraction = PaymentRequest.ShopperInteractionEnum.ContAuth, ShopperReference = "YOUR_SHOPPER_REFERENCE" }; // Send the request var service = new PaymentsService(client); var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### Go ```go // Adyen Go API Library v21.0.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) amount := checkout.Amount{ Currency: "EUR", Value: 1000, } sepaDirectDebitDetails := checkout.SepaDirectDebitDetails{ StoredPaymentMethodId: common.PtrString("7219687191761347"), Type: common.PtrString("sepadirectdebit"), } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_ORDER_NUMBER", Amount: amount, MerchantAccount: "YOUR_MERCHANT_ACCOUNT", RecurringProcessingModel: common.PtrString("Subscription"), PaymentMethod: checkout.SepaDirectDebitDetailsAsCheckoutPaymentMethod(&sepaDirectDebitDetails), ShopperInteraction: common.PtrString("ContAuth"), ShopperReference: common.PtrString("YOUR_SHOPPER_REFERENCE"), } // 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 v13.6.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 = { "amount": { "value": 1000, "currency": "EUR" }, "paymentMethod": { "type": "sepadirectdebit", "storedPaymentMethodId": "7219687191761347" }, "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "reference": "YOUR_ORDER_NUMBER", "shopperReference": "YOUR_SHOPPER_REFERENCE", "shopperInteraction": "ContAuth", "recurringProcessingModel": "Subscription" } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v10.4.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 = { :amount => { :value => 1000, :currency => 'EUR' }, :paymentMethod => { :type => 'sepadirectdebit', :storedPaymentMethodId => '7219687191761347' }, :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :reference => 'YOUR_ORDER_NUMBER', :shopperReference => 'YOUR_SHOPPER_REFERENCE', :shopperInteraction => 'ContAuth', :recurringProcessingModel => 'Subscription' } # Send the request result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v29.0.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 amount: Types.checkout.Amount = { currency: "EUR", value: 1000 }; const sepaDirectDebitDetails: Types.checkout.SepaDirectDebitDetails = { storedPaymentMethodId: "7219687191761347", type: Types.checkout.SepaDirectDebitDetails.TypeEnum.Sepadirectdebit }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_ORDER_NUMBER", amount: amount, merchantAccount: "YOUR_MERCHANT_ACCOUNT", recurringProcessingModel: Types.checkout.PaymentRequest.RecurringProcessingModelEnum.Subscription, paymentMethod: sepaDirectDebitDetails, shopperInteraction: Types.checkout.PaymentRequest.ShopperInteractionEnum.ContAuth, shopperReference: "YOUR_SHOPPER_REFERENCE" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Make an unscheduled card-on-file payment [Make an unscheduled card-on-file](/online-payments/tokenization/make-token-payments#make-a-subscription-or-unscheduled-card-on-file-payment) using the standard tokenization parameters. The payment will be processed as a SEPA Direct Debit payment. You do not need to include any additional parameters. **Make an unscheduled card-on-file payment with a SEPA token** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "amount":{ "value":1000, "currency":"EUR" }, "paymentMethod":{ "type":"sepadirectdebit", "storedPaymentMethodId":"7219687191761347" }, "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "reference":"YOUR_ORDER_NUMBER", "shopperReference":"YOUR_SHOPPER_REFERENCE", "shopperInteraction":"ContAuth", "recurringProcessingModel": "UnscheduledCardOnFile" }' ``` #### Java ```java // Adyen Java API Library v39.3.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) Amount amount = new Amount() .currency("EUR") .value(1000L); SepaDirectDebitDetails sepaDirectDebitDetails = new SepaDirectDebitDetails() .storedPaymentMethodId("7219687191761347") .type(SepaDirectDebitDetails.TypeEnum.SEPADIRECTDEBIT); PaymentRequest paymentRequest = new PaymentRequest() .reference("YOUR_ORDER_NUMBER") .amount(amount) .merchantAccount("YOUR_MERCHANT_ACCOUNT") .recurringProcessingModel(PaymentRequest.RecurringProcessingModelEnum.UNSCHEDULEDCARDONFILE) .paymentMethod(new CheckoutPaymentMethod(sepaDirectDebitDetails)) .shopperInteraction(PaymentRequest.ShopperInteractionEnum.CONTAUTH) .shopperReference("YOUR_SHOPPER_REFERENCE"); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentResponse response = service.payments(paymentRequest, 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) $amount = new Amount(); $amount ->setCurrency("EUR") ->setValue(1000); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setStoredPaymentMethodId("7219687191761347") ->setType("sepadirectdebit"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_ORDER_NUMBER") ->setAmount($amount) ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT") ->setRecurringProcessingModel("UnscheduledCardOnFile") ->setPaymentMethod($checkoutPaymentMethod) ->setShopperInteraction("ContAuth") ->setShopperReference("YOUR_SHOPPER_REFERENCE"); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v32.1.1 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) Amount amount = new Amount { Currency = "EUR", Value = 1000 }; SepaDirectDebitDetails sepaDirectDebitDetails = new SepaDirectDebitDetails { StoredPaymentMethodId = "7219687191761347", Type = SepaDirectDebitDetails.TypeEnum.Sepadirectdebit }; PaymentRequest paymentRequest = new PaymentRequest { Reference = "YOUR_ORDER_NUMBER", Amount = amount, MerchantAccount = "YOUR_MERCHANT_ACCOUNT", RecurringProcessingModel = PaymentRequest.RecurringProcessingModelEnum.UnscheduledCardOnFile, PaymentMethod = new CheckoutPaymentMethod(sepaDirectDebitDetails), ShopperInteraction = PaymentRequest.ShopperInteractionEnum.ContAuth, ShopperReference = "YOUR_SHOPPER_REFERENCE" }; // Send the request var service = new PaymentsService(client); var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### Go ```go // Adyen Go API Library v21.0.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) amount := checkout.Amount{ Currency: "EUR", Value: 1000, } sepaDirectDebitDetails := checkout.SepaDirectDebitDetails{ StoredPaymentMethodId: common.PtrString("7219687191761347"), Type: common.PtrString("sepadirectdebit"), } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_ORDER_NUMBER", Amount: amount, MerchantAccount: "YOUR_MERCHANT_ACCOUNT", RecurringProcessingModel: common.PtrString("UnscheduledCardOnFile"), PaymentMethod: checkout.SepaDirectDebitDetailsAsCheckoutPaymentMethod(&sepaDirectDebitDetails), ShopperInteraction: common.PtrString("ContAuth"), ShopperReference: common.PtrString("YOUR_SHOPPER_REFERENCE"), } // 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 v13.6.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 = { "amount": { "value": 1000, "currency": "EUR" }, "paymentMethod": { "type": "sepadirectdebit", "storedPaymentMethodId": "7219687191761347" }, "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "reference": "YOUR_ORDER_NUMBER", "shopperReference": "YOUR_SHOPPER_REFERENCE", "shopperInteraction": "ContAuth", "recurringProcessingModel": "UnscheduledCardOnFile" } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v10.4.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 = { :amount => { :value => 1000, :currency => 'EUR' }, :paymentMethod => { :type => 'sepadirectdebit', :storedPaymentMethodId => '7219687191761347' }, :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :reference => 'YOUR_ORDER_NUMBER', :shopperReference => 'YOUR_SHOPPER_REFERENCE', :shopperInteraction => 'ContAuth', :recurringProcessingModel => 'UnscheduledCardOnFile' } # Send the request result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v29.0.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 amount: Types.checkout.Amount = { currency: "EUR", value: 1000 }; const sepaDirectDebitDetails: Types.checkout.SepaDirectDebitDetails = { storedPaymentMethodId: "7219687191761347", type: Types.checkout.SepaDirectDebitDetails.TypeEnum.Sepadirectdebit }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_ORDER_NUMBER", amount: amount, merchantAccount: "YOUR_MERCHANT_ACCOUNT", recurringProcessingModel: Types.checkout.PaymentRequest.RecurringProcessingModelEnum.UnscheduledCardOnFile, paymentMethod: sepaDirectDebitDetails, shopperInteraction: Types.checkout.PaymentRequest.ShopperInteractionEnum.ContAuth, shopperReference: "YOUR_SHOPPER_REFERENCE" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` ## Test and go live Before accepting live payments, test your integration using the test environment and sample data provided by Klarna. You can then check the status of Klarna test payments in your [Customer Area](https://ca-test.adyen.com/) > **Transactions** > **Payments**. Before going live make sure to enable Klarna Debit Risk on your live merchant account on the [Customer Area](https://ca-live.adyen.com/). ## See also * [API-only integration guide](/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=API%20only)