Payment-method icon

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.
Redirect handling Make sure that your existing integration is set up to handle the redirect.
action.type: redirect.
Setup steps Before you begin, add Klarna Debit Risk in your Customer Area.

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. (No details are required for this payment method.)
  3. When you make the payment request, you include additional information about the shopper.
  4. Your existing integration setup will 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 of the shopper.

You can download the logo for Klarna Debit Risk to use in your form.

Get Klarna Debit Risk as an available payment method

When you make the /paymentMethods to get available payment methods, specify the following so that Klarna Debit Risk is included in the response.

Parameter Values
countryCode AT, BE, DE, NL, ES, CH
amount.currency EUR, CHF

Add additional parameters to your /payments request

You do not need to add any additional parameters when you make a payment, but make sure to include the following parameters:

Parameter Required Description
paymentMethod.type -white_check_mark- Set to directEbanking.
returnUrl -white_check_mark- URL to where the shopper should be redirected back to after they complete the payment.
countryCode -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 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 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 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.

The response includes the action.type: redirect.

Handle the redirect

  1. To complete the payment, redirect the shopper to the action.url returned in the /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 for iOS or Chrome Custom Tabs for Android, instead of WebView objects. Also refer to the security best practices 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 request, specifying:

    • details: object that contains the URL-decoded redirectResult returned when the shopper was redirected back to your site.

    You receive a /payments/details response containing:

    • resultCode: Use this to present the result to your shopper.
    • pspReference: Our unique identifier for the transaction.

Show the payment result

Use the resultCode that you received in the /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.
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. To make recurring payments, you need to:

  1. Create a shopper token.
  2. Use the token to make future payments for the shopper.

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 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 request:

Parameter Required Description
paymentMethod.type -white_check_mark- Set to directEbanking.
returnUrl -white_check_mark- URL to where the shopper should be redirected back to after they complete the payment.
countryCode -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 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 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 The phone number of the shopper. If included, Klarna will pre-fill it in the Klarna log-in screen.
recurringProcessingModel -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 -white_check_mark- Indicates the sales channel through which the shopper authorizes the payment. For online transactions, this is Ecommerce.
shopperReference -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 -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.

When a token is created, you receive a 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 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

Make an unscheduled card-on-file 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.

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 > Transactions > Payments.

Before going live make sure to enable Klarna Debit Risk on your live merchant account on the Customer Area.

See also