When the recommended integration approach of Klarna Mobile SDK is not possible, the guide below will guide you through how to integrate your web checkout in your mobile app without the Mobile SDK.
![]() | ![]() | ![]() |
Your checkout screen when Klarna is selected as payment method. | Hosted Payment Page flow starts when customer confirms to Continue with Klarna. | Your order confirmation screen after a successful payment. |
This guide will lead you through all the steps required to accept Klarna Payments in your mobile app using your web integration. At the end, you will be able to accept payments with Klarna with very few native changes.
Klarna still recommends Klarna Mobile SDK as first choice for Web Checkout integrations in mobile apps, Mobile SDK WebView integrations can be utilized instead of System WebViews in such cases.
This guide assumes that you already have a web checkout integrated with Klarna Payments and you intend to use it in your mobile application.
If you haven't done such web integration, we suggest you to check the recommended integration approaches here. These will also help you offer better UX and more stable integration than System WebViews.
Klarna purchase flows might require authorizations in other applications (e.g. bank apps) or do a handover to the Klarna app. In such cases, a return URL to your application ensures seamless return to the flow in your app, hence setting up a return URL is required. It is expected that redirects to this URL should only open your application without any changes in the UI state, ensuring the customer can continue the flow prior to external navigation.
You can read more about how deep links and intent filters work on the Android Developers site.
You can set up a Return URL app scheme for your application by registering an intent-filter
for the Activity you integrated Klarna, in your app’s AndroidManifest.xml
:
<application...>
<activity...>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="<your-custom-scheme>" />
<data android:host="<your-custom-host>" />
</intent-filter>
</activity>
Important: Construct the return URL string passed to Klarna by combining the attributes defined in your <intent-filter>
's <data>
tags, following the standard URL format: <your-custom-scheme>://<your-custom-host>
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
intent?.data?.let { uri ->
if (uri.host == Contants.klarnaReturnUrl.host && uri.host == Contants.klarnaReturnUrl.host) {
// This is a return URL for Klarna – skip deep linking
return
}
// This was not a return URL for Klarna
}
}
The hosting Activity
should be using launchMode
of type singleTask
or singleTop
to prevent a new instance from being created when returning from an external application.
As Android Custom Tabs will be shown to the customer during the flow, we require Activity set up for intent-filter to finish immediately and retain Custom Tabs on top.
class RedirectActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
handleRedirect(intent)
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleRedirect(intent)
}
When creating a payment session, make sure you backend sets merchant_urls.app_return_url
to return URL set up for the app.
On Android, system WebViews are commonly implemented using Android Custom Tabs. By default, Custom Tabs share cookies and session data with the device’s default browser (e.g., Chrome or Firefox). This shared session capability is essential for Klarna, as it allows us to recognize returning customers across sessions and provide a seamless checkout experience.
While it's possible to disable session sharing using Ephemeral Custom Tabs, we require persistent (non-ephemeral) sessions as this functionality enables Klarna to maintain customer context across the device.
dependencies {
implementation 'androidx.browser:browser:<latestVersion>'
}
val customTabsIntent = CustomTabsIntent.Builder()
.setEphemeralBrowsingEnabled(false) // only available in android.browser version 1.9.0
.build()
customTabsIntent.launchUrl(this, sessionUrl.toUri()) // URL of your web checkout for this customer session
After the purchase is completed, Klarna payment flow will be closed and the customer will be taken back to your checkout page where you will be notified for the authorized session in your web integration. From your checkout or the confirmation page, you can choose to redirect the customer back to your application.
To get the user back to your application from System WebViews, you can redirect to any intent-filter
set for the Activity
that you want to return to from your checkout or confirmation pages, as those will be loaded in the System WebView.
![]() | ![]() | ![]() |
Klarna purchase flow in System WebView. | Your checkout page in System WebView. | Your confirmation page in System WebView. |
As you are re-using your web integration, this integration approach assumes that you have implemented order creation via the integration that exists in web. Hence, this documentation does not cover this step, if you would like to learn more about authorizing a session and creating an order in web, check out these documentations:
Klarna Mobile SDK provides a full suite of mobile-first integrations, including Klarna products like:
![]() | ![]() | ![]() |
Sign in with Klarna | On-site Messaging | Express Checkout |
Complete your integration with