Klarna
Basic information
Klarna lets customers authenticate and choose from the payment options available on its hosted payment page.
- Integration paths: Direct API, Checkout, Web SDK
- Transaction type: One-time payment
lpmsInfo.lpmsType:Klarna- Web SDK
config.paymentMethod:['Klarna']
| Customer country/region | Order currency |
|---|---|
| 🇦🇹 AT, 🇧🇪 BE, 🇩🇪 DE, 🇪🇸 ES, 🇫🇮 FI, 🇫🇷 FR, 🇬🇷 GR, 🇮🇪 IE, 🇮🇹 IT, 🇳🇱 NL, 🇵🇹 PT | EUR |
| 🇦🇺 AU | AUD |
| 🇨🇦 CA | CAD |
| 🇨🇭 CH | CHF |
| 🇨🇿 CZ | CZK |
| 🇩🇰 DK | DKK |
| 🇬🇧 GB | GBP |
| 🇳🇴 NO | NOK |
| 🇳🇿 NZ | NZD |
| 🇵🇱 PL | PLN |
| 🇷🇴 RO | RON |
| 🇸🇪 SE | SEK |
| 🇺🇸 US | USD |
The customer country/region is the billingInformation.country value in the payment request.
This guide covers enabled configurations. Supply the customer’s billing name, contact details, and address before starting payment, as described in Before you begin; the Direct API section lists the fields for that path. Before integrating another market or using another order currency, confirm the enabled scope for your merchant account and application with Onerway, then use List available payment methods to check the current order.
Before you begin
Complete Setup and confirm with Onerway that Klarna is enabled. Also confirm applicable transaction limits, payment validity periods, and settlement arrangements. For amount formatting, see Currency and amount validation.
Collect the customer’s billing name, email, phone number, and address. Submit these in billingInformation when creating the payment, using the field formats in the API Reference and the customer’s actual billing country. Follow the API conditions for shipping information. Configure your server notification URL and customer return URL, and store the mapping between your order and paymentId.
Start the payment
Direct API
For this Direct API flow, collect the customer details before creating the payment and supply firstName, lastName, email, country, phoneCountryCode, phone, province, city, postalCode, and address in billingInformation. Use the customer’s actual billing country and follow the API conditions for shipping information and any other fields.
Use a local phone number without its country code in phone, and the corresponding dialing code as digits without + in phoneCountryCode. Submit the complete address in address and the province or state code in province, using the API field formats.
Use DIRECT and SALE for this one-time payment. A payment plan chosen on the Klarna page does not require Onerway installment or subscription parameters.
- Check List available payment methods for the current order. After the customer selects Klarna, call Create direct transaction from your server with
productType=LPMS,subProductType=DIRECT,txnType=SALE, andpaymentMode=WEB. SetlpmsType=KlarnainlpmsInfo, encoded as a JSON string. - Supply the customer details listed above in
billingInformation, and follow the API requirements forshippingInformation. Encode both as JSON strings. Include products, notification and return URLs, and merchant-collected end-user IP, browser, and device information intxnOrderMsg. Keep product and order currencies consistent, with product amounts, discounts, and shipping fees adding up toorderAmount.
Select the request example “Redirect local payment request (illustrative)”. It uses Bancontact / BE / EUR to show the shared structure. Replace the method withKlarna, use the order currency in the table above for the customer country/region, and supply the actual order and the customer details required by this Direct flow. The example amount does not establish a transaction limit. - Store the returned
paymentIdandtransactionId. Whenstatus=RandactionType=RedirectURL, direct the customer to the returnedredirectUrl. The response example “Redirect local payment response (illustrative)” shows this shape. For other actions or states, follow Local payment integration. Do not repeatedly create the same order while waiting. - The customer follows the payment flow opened by the returned URL to complete authorization or payment confirmation. When the customer returns to your site, display the result retrieved from your server. See Request authentication for authentication.
Checkout
When locking Checkout to this method, first call List available payment methods for the current order and confirm that the method is returned. When Checkout displays all available methods, Onerway performs this filtering.
- On your server, call Create checkout payment with
productType=ALL,subProductType=DIRECT, andtxnType=SALE. To show only Klarna, setlpmsInfo.lpmsTypetoKlarna, sendinglpmsInfoas a JSON string. If you omitlpmsInfo, the customer chooses from the methods available for the order. - Supply the billing, shipping, product, return URL, and notification URL fields required by the API. Encode
billingInformationandshippingInformationas JSON strings, including the required email and country for each. Keep product and order currencies consistent and ensure that product amounts, discount entries, and shipping fees add up toorderAmount.
Select the request example “Unified Checkout with all available payment methods”, replace the order and customer details, and add this method'slpmsInfoif you want to select only this method. Use the order currency in the table above for the customer country/region. Remove the example’scardInfoobject for this flow. For this Checkout flow, include the collectedfirstName,lastName,email,phone,country,address,city, andpostalCodeinbillingInformation. Apply the API field conditions and phone format. - Select the response example “Unified Checkout session created”. Store the returned
paymentIdandtransactionIdagainst your order, then redirect the customer's browser toredirectUrl. The initialstatus=Umeans that payment has not been completed. - Onerway Checkout handles the payment page and customer payment interaction. When the customer reaches
returnUrl, retrieve the order result from your server. If no notification has arrived, use the stored transaction identifier to Query transactions. For request authentication, redirects, and return handling, see Checkout integration.
Web SDK
Keep the SDK payment-method interface and provide the customer details for this SDK path when creating the transaction. Submit the collected firstName, lastName, email, phone, country, address, city, and postalCode in billingInformation, encoded as a JSON string. Follow the API conditions for other fields. The linked “One-time SDK payment” example omits these billing details; add them when implementing this flow.
- On your server, call Create SDK transaction with
productType=ALL,subProductType=DIRECT, andtxnType=SALE. Select the request example “One-time SDK payment” and the response example “One-time SDK transaction created”. These examples show the shared creation flow before a payment method is selected. Replace the amount, currency, and product details with the actual order, keeping the product and order currencies consistent. - Initialize Checkout with the returned
paymentId, following Web SDK integration. To display only this method, setconfig.paymentMethodto['Klarna']in the initialization options. Then subscribe to events and mount the Payment Element. This configuration only filters methods returned by the server; it does not enable Klarna. - In the
readyevent, check thatavailablePaymentMethodscontainsKlarna. - After the customer selects Klarna and completes any fields shown, call
confirmPayment()from your payment button. Handle the actualpaymentStatusandnextActionreturned. For the complete event and error handling flow, see Web SDK integration.
With the Web SDK, paymentStatus=R means that customer interaction must continue. Handle the actual nextAction.type returned:
PresentToShopper: keep the current SDK Checkout instance and leave its Payment Element mounted while the SDK presents the payment interface, wait forpayment_result, and do not callconfirmPayment()again.RedirectShopper: wait for the customer to reach thereturnUrlsupplied when creating the order, then query the order on your server. Initially show that the result is being confirmed.
Customer actions and final result
On the Klarna page, customers authenticate as prompted, review their order and available payment options, and select an option. They review its amount and terms, then confirm payment and complete any additional authorization. Authentication may require a phone verification step; follow the current page’s instructions.
Klarna determines which payment options to offer for the customer and merchant. Do not promise a particular installment plan or payment schedule; customers review the available options and their terms on the Klarna page.
Customers may close or leave the page before completing authorization. Restore the customer-facing interaction as appropriate, and retrieve the order result from your server. Authentication, choosing an option, or reaching your return URL alone must not mark the order as paid.
Process the order on your server using a signature-verified payment result webhook. If the notification has not arrived or you need to check the result, call Query payments with the stored paymentId. Fulfill the order only after your server confirms a successful payment. For verification, acknowledgement, idempotency, and query fallback, see Webhooks.
Refunds and disputes
Before integration, confirm the refund capabilities, restrictions, and dispute process applicable to your merchant with Onerway. If refunds are enabled, follow Refunds.
Testing and go-live
Confirm the test environment, available Klarna test procedure, and customer test data with Onerway, then follow Sandbox testing:
- Test each path you use with the order currency for the customer country/region and the customer details required for that path. For the Direct API, handle the actual response and verify that
R + RedirectURLopens the returned URL. For Checkout, confirm that the firstredirectUrlopens Checkout and thatKlarnais available. For the Web SDK, check thatready.availablePaymentMethodscontainsKlarna. - Open the Klarna page, verify the order and available payment options, and complete the agreed authentication and payment test. Confirm the result on your server before updating the order; merely opening the payment page does not pass the successful-payment check. For go-live acceptance, retain the notification and acknowledgement for the same order, then make an active query to verify that the results agree.
- Test a customer leaving before authorization, an unsuccessful authentication or payment, and a return to your site before a final result. If the page displays a deadline, also test the agreed expiry handling. Confirm that a return to your site alone never marks the order as paid, and test query fallback when no notification has arrived.
- Verify idempotent handling of duplicate notifications. Before going live, check production enablement, notification and return URLs, limits, and validity periods. Test refunds separately if they are enabled.