Integration resilience

Idempotency

Idempotency is a key concept in system operations, ensuring that repeating the same action multiple times doesn't change the outcome after the first execution. This principle is crucial for maintaining consistency and reliability, particularly in payments integrations, enhancing customer experience and system stability.

Klarna requires idempotent integration of its systems for actions that could change a transaction's status. This safeguards against unwanted changes or duplications if a request is repeated. To manage this, you can use the Klarna-Idempotency-Key header in all POST and PATCH requests. An idempotency key should be created using the UUIDv5 standard, and is valid for 24 hours - outside of that window Klarna cannot guarantee the idempotency key will be honored with respect to an action.

This enables Klarna to recognize and ignore repeat requests to ensure an action is not unintentionally duplicated. In the case of a duplicate attempt, Klarna will respond with the initial result instead of processing a new one.

Tagging

Integration tagging is a crucial mechanism for improving the integration experience by providing detailed and consistent data to support customer experience, performance tracking, and incident resolution. All operations and interactions with Klarna should be tagged with associated integration partners to ensure granular monitoring and performance. To provide this level of detail, Klarna requires that partners provide all available information with each interaction.

Release notes Integration tagging is currently under development and is subject to change. It will become available in future releases.

This section provides in-depth instructions and examples for partners on how to implement integration tagging to ensure effective data provision with Klarna.

Naming standardization

To enable Acquiring Partners to provide all integrated partners without additional validation, and avoid unnecessary rejections of requests when a new partnership is provided, the naming parameters in Klarna’s tagging solution are unvalidated strings, not enums. As such it is required that naming conventions are followed whenever a new application name is provided.

⚠️ Note: In cases where Klarna recognizes a partnership under a different name, Klarna agents may reach out to request the value provided be adjusted to remain consistent across multiple integrators
Conventions when providing integrator names

To maximize the possibility of alignment in naming conventions without maintaining a list of all possible applications, Please ensure that your name parameters follow the below naming conventions:

  • Base any name used off of the commonly used naming convention for the application - what they call themselves externally towards customers.
  • Use PascalCase where multiple words are involved in an application name.
  • Standardize language-specific characters and convert characters with diacritics or accents to their base form for consistent handling. (e.g “Rénault” becomes “Renault”)
  • Strip out spaces and punctuation
  • Separate the company name from it’s legal form (e.g. “Klarna Inc.” and “Klarna AB” both become “Klarna”)
  • Do not include regions or countries within an application name where it doesn’t express fundamental differences in the performance of the product. (e.g. “Klarna US” and “Klarna SE” both become “Klarna”)
Predefined platforms

Below is a list of key platforms with predefined strings. All tagging requests involving these partners must match their name parameter to the strings below. More information on these partnerships can be found in the links provided alongside the list. In this context, the term “platform” is used to describe any specific layer within the integration. Acquiring Partners are considered “platform” in this context. Contact Klarna Solutions Engineers if the platforms are not in the list.

Platform name Predefined string
24Nettbutikk 24Nettbutikk
4webs 4Webs
Abicart AB AbicartAb
ACIWorldwide ACIWorldwide
Addis Addis
Adobe Commerce (Magento) AdobeCommerce
Adyen Adyen
Aera Payment & Identification AeraPayment&Identification
Airwallex Airwallex
Alcalink Alcalink
Alipay Alipay
Alphabank Alphabank
Altapay Altapay
Antom Antom
Apexx Apexx
Aptos Aptos
AQS Aqs
Artdinamica Artdinamica
Askås I & R AskåsI&R
Aurus Aurus
AutoPay Autopay
AvantiCart Avanticart
Avensia Avensia
Axerve S.p.A AxerveS.P.A.
Ayla Diseño y Tecnología AylaDiseñoYTecnología
Bank of America BankOfAmerica
Banorte Banorte
Banque Populaire BanquePopulaire
BBVA Bbva
BigCommerce BigCommerce
Billwerk+ Billwerk+
BlackPepper Blackpepper
BlueSnap Bluesnap
Blugento Blugento
BNPP Bnpp
Bold Commerce BoldCommerce
BPCE Bpce
Braintree Braintree
BrinkCommerce Brinkcommerce
Buckaroo Buckaroo
Cafe24 Cafe24
CardinalCommerce Cardinalcommerce
Cardlink Cardlink
CCV Group B.V. CcvGroupB.V.
Cegid Cegid
Centra Centra
Checkout Checkout
Citcon Citcon
Citibank Citibank
ClearHaus ClearHaus
Clearis Clearis
CloudCart CloudCart
CodaPayment Codapayment
Comerzzia Comerzzia
Comgate Comgate
CommerceTools Commercetools
Commerzia Commerzia
Computop Computop
Conecta Software ConectaSoftware
Conekta Conekta
ContentSpeed (Payten) Contentspeed
Cosin Cosin
Credit Agricole CreditAgricole
Credit Mutuel CreditMutuel
Crisp Studio CrispStudio
CS Cart CsCart
Cybersource Cybersource
Danal Danal
DanDomain Dandomain
DAPP Dapp
DEUNA Deuna
Deutsche Bank DeutscheBank
Digital River DigitalRiver
Digital Takeout DigitalTakeout
Dintero Dintero
Dir&Ge Dir&Ge
Dlocal Dlocal
DNA Payments DnaPayments
e-shop 360 E-Shop360
Easypay Easypay
Ebanx Ebanx
eComm360 Ecomm360
eCommerce news EcommerceNews
ecwid Ecwid
Egloba Egloba
EKMPowershop Ekmpowershop
Elavon Elavon
Enactor Enactor
epay Epay
EpiServer Episerver
Eromnet* Eromnet*
eService Eservice
eShopWorld Eshopworld
eStudio 34 Estudio34
Eupago Eupago
EuPlatesc Euplatesc
Eurobank Eurobank
eValent Evalent
Eximbay Eximbay
Extended Extended
FAPS Faps
FIK Fik
Finqu Oy FinquOy
Fintk Consulting FintkConsulting
First Data FirstData
FIS Fis
FiServ (Clover, Telecash, AIB) Fiserv
FlatPay Flatpay
Flooid Flooid
FreedomPay Freedompay
GetNet Getnet
GK Software GkSoftware
Global Payments (Evo Payments) GlobalPayments
GlobalE Globale
GoDaddy Godaddy
Gomag Gomag
GoPay Gopay
Hiberus Hiberus
HiPay SAS HipaySas
Hobex Hobex
Holipay Holipay
Hostinger Hostinger
I’mweb I’Mweb
ICG Icg
Idosell/IAI Idosell/Iai
Ifthenpay Ifthenpay
Ilion Ilion
Ingenico Ingenico
Intershop Intershop
Ixopay Ixopay
J.P. Morgan J.P. Morgan
Jimdo Jimdo
JPM Jpm
JTL Shop JtlShop
Jumpseller Jumpseller
KG Inicis KgInicis
Kodmyran Kodmyran
Kushki Kushki
Kvanto Kvanto
Labelgrup Labelgrup
Legends Legends
Lemonway Lemonway
Lightspeed Lightspeed
Línea Gráfica LíneaGráfica
Litium Litium
Lloyd Lloyd
LMS-Sport Lms-Sport
Logpay Logpay
Lyra Network LyraNetwork
Maktagg Maktagg
Mangopay Mangopay
Marketpay Marketpay
MerchantPro Merchantpro
Microsoft Dynamics Navision MicrosoftDynamicsNavision
MobilePay MobilePay
MODDO Moddo
Mollie Mollie
Mondido Mondido
Monei Monei
Moneris Moneris
Monext Monext
Multisafepay Multisafepay
myPOS Mypos
Mystore Mystore
NBG Nbg
NCR Ncr
Netgiganten.dk Netgiganten.Dk
Nethit Systems NethitSystems
Netopia Netopia
Netsite Netsite
Nexi Group (Nets, Concardis, Computop, Paytrail) NexiGroup
NHN Commerce NhnCommerce
NHN KCP NhnKcp
Nice Payments NicePayments
Norce (Jetshop/Storm) Norce
Nordicway Nordicway
Novalnet Novalnet
Nuvei Nuvei
OC Payment GmbH OcPaymentGmbh
Oceanpayment Oceanpayment
Odero (TOKEN) Odero
Ohdigital Ohdigital
Okisam Okisam
One.com One.Com
OneBox OneBox
Onil Onil
OnlinePaymentPlatform Onlinepaymentplatform
Openbravo Openbravo
Opencart Opencart
Openpay Openpay
Optimizely Optimizely
Oracle Commerce Cloud OracleCommerceCloud
Orbital Revolution OrbitalRevolution
Outpayce (part of Amadeus) Outpayce
OxidESales Oxidesales
P24 P24
Pacypay Pacypay
Pay.nl Pay.Nl
Paybyrd Paybyrd
Payco Payco
PayComet Paycomet
PayerMax Payermax
PayGreen Paygreen
Payletter Payletter
Paylike Paylike
Payline Payline
Payment Sense PaymentSense
Paymentwall Paymentwall
PayNow Paynow
Payone Payone
Payoneer Payoneer
PayPlug Enterprise SaaS PayplugEnterpriseSaas
Payrexx Payrexx
PaySafe Paysafe
Paytrim Paytrim
PayU Payu
Payxpert Payxpert
PensoPay Pensopay
PeP Pep
PHC Phc
PingPong Pingpong
Pireaus Bank PireausBank
Planet Payment (DataTrans) PlanetPayment
Plati.online Plati.Online
Polcard Polcard
PPRO Ppro
Prestashop Prestashop
Primavera Primavera
Primer Primer
ProcessOut Processout
Prosa Prosa
Pulse247 Oy (MyCashFlow) Pulse247Oy
PXP Financial PxpFinancial
Qenta Qenta
Quickbooks Quickbooks
Quickbutik Quickbutik
QuickPay Quickpay
Radial Radial
Razer Merchant Service RazerMerchantService
Reach Reach
Redicom Redicom
Redsys Redsys
Reduncle Reduncle
Reduniq Reduniq
Rocket Digital RocketDigital
Sabadell Sabadell
Sage Sage
Salesforce Commerce Cloud SalesforceCommerceCloud
SAP (Hybris) Sap
Scannet Scannet
Scayle Scayle
SDi Digital Group SdiDigitalGroup
Seidor Seidor
Shift4 Shift4
Shoper Shoper
Shopify Shopify
ShopLazza Shoplazza
Shopline Shopline
Shoptet Shoptet
Shopware Shopware
SIBS Sibs
Simpler Simpler
Simply.com Simply.Com
Sipay Sipay
Six Saferpay SixSaferpay
Smallpay S.r.l. SmallpayS.R.L.
solteq Solteq
Square Square
Squarespace Commerce SquarespaceCommerce
Strato Strato
Stripe Stripe
Studioforty9 Studioforty9
SumUp Sumup
Swedbank Pay SwedbankPay
TD Bank Merchant Solutions TdBankMerchantSolutions
Telecash Telecash
Tencent Tencent
Thunes Thunes
TiendaNube Tiendanube
Tier1 Tier1
Toss Payments TossPayments
Tpay Tpay
Trevenque Sistemas de Inflormación TrevenqueSistemasDeInflormación
Trilogi Trilogi
TrustPay Trustpay
Twice Commerce (prev. Rentle Oy) TwiceCommerce
Unzer Unzer
Upstream pay UpstreamPay
Verifone Verifone
Vilkas Group VilkasGroup
Vipps Vipps
VismaPay Vismapay
Visualit Visualit
VisualSoft Visualsoft
VivaWallet Vivawallet
VR Payment VrPayment
Vtex Vtex
Wallee Wallee
Way2ecommerce Way2Ecommerce
Weasy.io Weasy.Io
Webimpacto Webimpacto
Webmefy Webmefy
Wells Fargo WellsFargo
Westpay Westpay
Wikinggruppen Wikinggruppen
Windcave Windcave
Wix Wix
Wizishop Wizishop
Woocommerce Woocommerce
woolman Woolman
WorldFirst Worldfirst
Worldline Worldline
Worldpay Worldpay
Xsolla Xsolla
xt commerce XtCommerce
Young Pixel YoungPixel
Zettle by Paypal ZettleByPaypal

Data requirements

The X-Klarna-Integration-Metadata header object encapsulates information about all known integration pathways involved in a given request.

Request context object

request_context provides details of the client responsible for the request, and Acquiring Partners are required to pass this object with every request.

  • Platform name : The name of the platform sending the request to Klarna. Values are not validated, but Klarna may request the value provided be adjusted to remain consistent across multiple integrators. See predefined platforms for a list of accepted strings for defined platforms.
  • Application name : The name of the application sending the request to Klarna. This allows Klarna to recognize different applications under the same platform. Values are not validated.
  • Application reference : A long-lived, unique identifier assigned by the application associated with an overall transaction or session. This identifier is stored within Klarna’s logs, empowering agents to investigate issues with downstream applications.
  • Version : The version of the integration indicated by the name parameter.
**Application metadata

application_metadata is an array of objects representing all applications or platforms involved in providing information included within the request. This metadata provides a detailed view of the specific software platforms, programs or modules leveraged by the Partner.

  • Platform name: The name of the platform providing data passed towards Klarna in the request. Values are not validated, but Klarna may request the value provided be adjusted to remain consistent across multiple integrators. See predefined platforms for a list of accepted strings for defined partners.
  • Application name : The name of the application providing the data passed in the request to Klarna.
  • Application reference : An optional parameter containing a long-lived, unique identifier assigned by the application associated with an overall transaction or session. This identifier is stored within Klarna’s logs, empowering agents to investigate issues with downstream applications.
  • Version : An optional parameter indicating the version of the integration indicated by the name parameter.

Implementation pathways

WebSDK

For clients built on Klarna’s WebSDK, the WebSDK exposes an interface that allows developers to register their application information. Plugins that use WebSDK must call this interface to register their application information. The WebSDK should include this information on every call to the server.

Copy
Copied
 Klarna.appendAppInfo({
     name: 'Woocommerce',
     version: '1.0'
     applicationReference: 'Woo_5555-474'
})

If multiple parties trigger individual instances of the WebSDK, the data will be appended within the application_metadata array. The WebSDK will limit this array to no more than 6 objects, retaining the final 6 items in case of any conflict.

APIs

The integratation_metadata header object will allow for the passing of integration tagging information in all server-side requests. Although this field is technically optional, Acquiring Partners must send this information in every request towards Klarna, indicating both the version of their integration which triggers the request within requestcontext, in addition to any services which provide relevant data passed within the request in the applicationmetadata array.

Copy
Copied
integration_metadata: {
  application_metadata: [{
    platform_name: "WooCommerce",
    application_name: "StripePlugin",
    application_reference: "xxx"
    version: "1.0",
  }],
  request_context: {
    platform_name: "Stripe",
    application_name: "PaymentElement",
    application_reference: "xxx"
    version: "2.0",
  }
}
Plugins and platforms

For any plugin or platform managed by an Acquiring partner, partner tagging information should be included by default without additional effort from the Partner. Any plugin provisioning data directly towards Klarna should include itself within the requestcontext field, and any plugin passing information via an acquiring partner must be included within the `applicationmetadatafield - with the acquiring partner passed as therequest_context`. As partners are required to provide this information across all integration paths, the result allows monitoring of performance across multiple integrations.

Monitoring and alerting

To ensure compliance with integration best practices and data protection regulations, you must proactively monitor and share information about deviations from expected behaviors as outlined in the Partner-specific Solution Scope Document. This includes technical errors and unusual activities by customers or, where relevant, accounts or integrations occurring through your integration.

To support monitoring, you are required to meet the following criteria:

  • Immediately escalate any events that disrupt business operations, compromise the integrity or security of information systems, or impact the availability, confidentiality, or integrity of digital assets.
  • Address any disruptions or compromises affecting the operation and reputation of the Klarna payment system.
  • Ensure that all integration approaches must include a specific parameter that uniquely identifies the specific integration being used on that request or transaction. This parameter must be traceable across all integrations to ensure comprehensive incident handling, behavioral tracking, and account management.
  • Follow a release process that validates system functionalities and integration points in the test environment to detect and resolve issues before they impact system performance or customer experience.
  • All interactions with Klarna are tagged with the appropriate integration details and versions as defined in Integration tagging

Error handling

When an error occurs on API request, Klarna responds with an error type, an error code, an error message and a corresponding HTTP status code.

Klarna's APIs use HTTP status codes together with error objects to handle errors. When an API call fails Klarna will respond with a 4xx or 5xx status code together with a response body containing an error object with the error code, an array of error messages and a unique error id to be used to identify the request.

Parameter Definition
error_id A unique identifier for the request generated by Klarna. This ID will help you in investigations in case you need help from our support team.
error_type Type of the error. Different error types are ACCESS_ERROR, TECHNICAL_ERROR, RESOURCE_ERROR and INPUT_ERROR.
error_code Error code for further categorizing the error. We recommend using this error code for building your error handling logic.
error_message A human readable error message. The error message is not meant to be displayable to customers shopping, but to assist in technical troubleshooting.
doc_url Link to Klarna docs describing how to use the API to avoid the error, or a more detailed explanation of why the error occurred. To be provided when available.

Example of API response with an error details:

Copy
Copied
{
  "error_id": "abcd1234-12ab-1234-abcd-abcd12345678",
  "error_type": "INPUT_ERROR",
  "error_code": "VALIDATION_ERROR",
  "errors": [
    {
      "parameter": "line_items[0].quantity",
      "error_message": "Parameter line_items[0].quantity must be greater than or equal to 1",
      "doc_url": "https://docs.klarna.com/....."
    }
  ]}

Defined error types, and how to handle them

Error type Error code HTTP Status code Definition Handling
NOT_FOUND 404 The requested API route does not exist. Verify the API route.
ACCESS_ERROR UNAUTHORIZED 401 The presented credentials failed authentication. Verify the credentials, check the authentication method, and confirm the correct endpoint.
RATE_LIMITED 429 The caller was rate limited due to too many requests. See Rate Limiting for more details.
RESOURCE_ERROR RESOURCE_NOT_FOUND 404 The resource was not found. Verify the token provided in the request path. This issue may also occur if an attempt is made to update an expired shopping session.
RESOURCE_CONFLICT 409 There was a conflict in using the resource. The transaction details are conflicting with the request details. Might occur due to concurrent updates to the resource.
OPERATION_FORBIDDEN 403 The provided credentials (authorization) does not have enough privileges to perform the requested operation. Ensure that the credentials being used have the necessary permissions for the operation.
RATE_LIMITED 429 The specific resource was rate limited. For example creation of resources are rate limited, but it is still possible to run on already existing resources. See Rate Limiting for more details.
INPUT_ERROR VALIDATION_ERROR 400 One or more input parameters failed input validation. For example exceeding a max value, or failed pattern matching, invalid type. Verify that the request details and formats are correct. See the error message for more info.
INVALID_CONTENT_TYPE 400 The input does not conform to the expected content type syntax. For example invalid JSON. Verify that the content type is as expected.
TECHNICAL_ERROR INTERNAL_ERROR 500 An unknown error occurred. Reach out to your support contact and include the error message and the error id.
TEMPORARY_UNAVAILABLE 503 The system is temporarily unavailable to process the request. Reach out to your support contact and include the error message and the error id.