Authorize payments with Klarna seamlessly by integrating the Payment Authorize API to initiate transactions, handle approvals or declines, and optimize the process with supplementary purchase data.
In a usual server-side payment integration with an Acquiring Partner, the Partner will start the payment flow when the customer decides to pay with a given payment method. In the case where the customer selects Klarna, the Partner will then send a request to the Acquiring Partner to create a payment session with Klarna as the selected payment method, forwarding to the Acquiring Partner the mandatory data points such as returning address, etc.
In this occasion, Acquiring Partners will have to integrate with Klarna's Payment Authorization API, which will either directly proceed to authorize a Payment Transaction or require the customer to go through Klarna's Purchase Journey.
Before calling the Payment Authorization API, it is required to receive certain data points from the Partner to ensure a full end-to-end integration between the Partner's checkout flow and Klarna's Purchase Journey.
When Partners optimize their integration with Klarna, they are likely to have an interoperability_token
to share with the Acquiring Partner.
The interoperability data points (interoperability_token
and interoperability_data
) ensure all information and context associated with a Payment Transaction is preserved throughout the journey of a customer.
Klarna's interoperability_token
and interoperability_data
must be accepted through the Acquiring Partner's server-side API endpoints used by their Partners to initiate the payment.<br />
Below an example of how Acquiring Partners can accept the interoperability data points in their Create Payment request API endpoint.
{
"currency": "USD",
"amount": 17800,
"payment_method_options": {
"klarna": {
"interoperability_token": "eyJhbGciOiJ...",
"interoperability_data": "..."
}
}
}
The Partner-facing field should be named either klarna_interoperability_token
/klarna_interoperability_data
or interoperability_token
/interoperability_data
in a Klarna-specific context, ensuring that it’s easy for any Partner to identify and use.
As those parameters can change over time and are versioned so that the third party integration continues to work, Acquiring Partners need to respect these guidelines if they wish to validate parameters:
Parameter | Validation |
---|---|
interoperability_token | Base64 string between 0 and 2048 characters. |
interoperability_data | Base64 string between 0 and 32768 characters. |
The Acquiring Partner can validate the input based on the provided guidelines but must not modify it. The input must always be forwarded as received, without any interference.
Supplementary Purchase Data consists of datapoints associated with the payment that helps Klarna optimize the Purchase Journey and improve acceptance rate. These datapoints can be forwarded to Klarna through:
When Acquiring Partners allow Partners to provide additional data points directly through their APIs, such as line items or L2/L3 data for Card Network optimization, they must forward the same data to Klarna using supplementary_purchase_data
object of the Payment Authorization API.
Read more about Supplementary Purchase Data here.
Acquiring Partner must not add specific fields of the supplementary purchase data to their APIs for supporting Klarna, but rather make sure interoperability_data
and its requirements are properly implemented. Forwarding the data already collected is on the other hand mandatory as Partner should not have to integrate twice data they already share.
interoperability_token
to share with the Acquiring Partner. The Acquiring Partner’s payment session API should expose a parameter for this as seen previously.While usually triggering a step-up scenario, Payment Authorize API can also lead to a directly created Payment Transaction. When this possibility is not expected by the integration pattern of the Acquiring Partner, it is possible to force a step-up scenario.
In the request to the Payment Authorize API, the Acquiring Partner will specify the following parameters:
Path parameter
Parameter name | Description |
---|---|
partner_account_id | Identifier of the Partner account the action is done on behalf of. |
Header parameter
Parameter name | Description |
---|---|
Klarna-Interoperability-Token | Must contain the interoperability token if provided by the Partner. |
Request body
Parameter name | Description |
---|---|
currency | Currency in ISO 4217 format. |
request_payment_transaction | Represents a request to authorize a payment transaction. The amount parameter is sent through this object. The parameters will be transferred to the Payment Transaction created on a successful authorization. |
step_up_config | To support a step-up scenario, where the customer must approve the payment, Acquiring Partners must configure customer_interaction_config to determine how the purchase journey is launched. Applicable customer interaction config method for this integration pattern is HANDOVER .Acquiring Partners must also obtain a return_url and/or an app_return_url , to ensure proper redirection after authorization. This will be covered in detail in the section Handle step-up scenario.This object also allows Acquiring Partners to provide a payment_request_reference for the purpose of correlating the payment session or equivalent resource on your side with the Klarna Payment Request. This will also be exposed in payment request webhooks.This will be covered in detail in section Handle step-up scenario. |
supplementary_purchase_data | Additional information that provides more detailed information about the transaction, which helps reduce the risk of fraud and enhances transparency. Shopping basket, customer billing / shipping details or specific transaction data can be provided through this object. |
interoperability_data | This field should be used for any additional interoperability data sent by the Partner. |
If an interoperability_token
and interoperability_data
were shared by the Partner, they must be sent when calling the Payment Authorize API as defined in this section.
Below an example request body for the Payment Authorize API. (interoperability token sent as an HTTP header parameter)
{
"currency": "USD",
"supplementary_purchase_data": { .. },
"interoperability_data": "<serialized-json>",
"request_payment_transaction": {
"amount": 11800,
"payment_transaction_reference": "acquiring-partner-transaction-reference-1234"
},
"step_up_config": {
"payment_request_reference": "acquiring-partner-request-reference-1234",
The Payment Authorize API can yield 3 different outcomes depending on the transaction and the consumer:
Result | Description |
---|---|
APPROVED | The Payment Authorization is approved without additional customer interaction. A Payment Transaction is created and contained in the response. |
STEP_UP_REQUIRED | Additional customer interaction is required to authorize the payment. Those interactions need to happen in Klarna’s Purchase Journey and the customer has to be redirected to it. Read more about how to handle the Step-up Scenario. |
DECLINED | The payment cannot proceed due to reasons such as fraud, final decline or risk concerns. |
When the request is successful, a Payment Transaction is created on Klarna Network and will be available for post-purchase operations through the Payment Transactions API. No further customer interactions are needed and the Acquiring Partner can directly inform their partners that the payment session is completed and that the customer can be redirected to the order confirmation page.
Acquiring Partners must store the Klarna payment_transaction_id
for future operations on the transaction through the Payment Transactions API, such as capture and refund. The Acquiring Partner will receive the following parameters in the response.
Response body
Parameter name | Description |
---|---|
payment_transaction_response | The response for a payment transaction will contain the result parameter which specifies the outcome of the second authorization. In case of a successful Authorization (result APPROVED ), the response body includes the Payment Transaction object. |
payment_transaction | The Payment Transaction object represents a single payment transaction This field is only returned if the payment_transaction_response.result is set to APPROVED The payment_transaction_id returned is necessary to manage the Payment Transaction through the Payment Transaction API. |
Sample response - APPROVED
{
"payment_transaction_response": {
"result": "APPROVED",
"payment_transaction": {
"payment_transaction_id": "krn:payment:eu1:transaction:6debe89e-98c0-[...]",
"payment_transaction_reference": "acquiring-partner-transaction-reference-1234",
"amount": 11800,
"currency": "USD",
"payment_funding": {...},
"payment_pricing": {...}
If a transaction could not be approved by Klarna and step-up scenario cannot be triggered (due to missing configuration or for permanent decline), the Acquiring Partner will receive a decline. Declines should not be replayed without change of context.
The Acquiring Partner should inform the Partner that the payment could not be completed and the Partner should invite the customer to select another payment method.
Response body
Parameter name | Description |
---|---|
payment_transaction_response | The response for a payment transaction will contain the result parameter which specifies the outcome of the 1st authorization.In case a decline, the result will be set to DECLINED |
Sample response - DECLINED
{
"payment_transaction_response": {
"result": "DECLINED"
}
}
When a Payment Transaction could not be immediately created by Klarna and a step-up configuration was provided in the call to the Payment Authorization API, the Step-up scenario will be triggered and the Acquiring Partner will receive a STEP_UP_REQUIRED
result.
In case your systems cannot support a pattern where there is no consumer interaction at the initialization of the session, it is possible to force the Step-up flow. This can be achieved by adding the mode = REQUIRED
to the step_up_config
object.
The mode = REQUIRED
will be available in a future release.
In such scenario, the Payment Authorization API returns a Payment Request in the response. The expectation is that the customer will go through Klarna’s Purchase Journey to complete the payment, usually triggering authentication and payment option selection. The required work to properly make the step-up scenario work is outlined in the next section.
The following parameters are present in the response to the request.
Response body
Parameter name | Description' |
---|---|
payment_transaction_response | The response for a payment transaction will contain the result parameter which specifies the outcome of the 1st authorization. In case of the Step up flow the result will be set to STEP_UP_REQUIRED |
payment_request | The base properties of a Payment Request. This field is only returned if the payment_transaction_response.result is set to STEP_UP_REQUIRED .The state_context.customer_interaction object contains:
|
Sample response - STEP_UP_REQUIRED
{
"payment_transaction_response": {
"result": "STEP_UP_REQUIRED"
},
"payment_request": {
"payment_request_id": "krn:payment:eu1:request:552603c0-fe8b-4ab1-aacb-41d55fafbdb4",
"payment_request_reference": "acquiring-partner-request-reference-1234",
"amount": 11800,
"currency": "USD",
"state": "SUBMITTED",