Android / Native Approach
Integration guide for how to integrate Klarna Checkout in your Android app, using the Native approach.
The components in the Native approach are
- An integration from your system to Klarna Checkout
- An end-point on your servers, where Klarna Checkout is fetched from the mobile SDK
- Klarna Checkout SDK for mobile apps
- Your mobile app
Step 1. Installation
Either use Maven, or manually install the Klarna Checkout SDK for mobile apps in your environment.
If you don't use Maven, then manually download the Android SDK aar-library from github and define it in your build.gradle
Step 2. Prepare your app
Add permissions in your Android manifest file
Step 3. Prepare backend endpoint to fetch a Checkout snippet
In your mobile app you will need to fetch a Klarna Checkout HTML snippet from your web server. This integration guide will not go through the Klarna Checkout integration in detail, but assumes it has been set up already and is available at an API endpoint YOUR-URL on your servers. If needed, you can learn how to do it in the regular Klarna Checkout Integration guide here.
Step 4. Initialize SDK with the Checkout snippet
To initialize the Klarna Checkout in your native flow, you supply a Checkout HTML snippet from YOUR-URL
Setting the snippet will start preloading the checkout, which ensures a better experience for the users.
Step 5. Present Klarna Checkout view
Create a view and add it to a view group, to present the Klarna Checkout
Step 6. Configure event listeners
The only event you need to listen to is the “complete event”. When the complete event is triggered, redirect the customer to the confirmation page within your app.
Following is a code example of how this is done
Optionally, you may want to set up event listeners to track field changes in the Klarna Checkout before the order is placed. See the reference guide for what events are available.
Success! You now have Klarna Checkout up and running in your mobile app.
Check out our git-hub page where you can
- Read API documentation
- Look at an example app
- Report an issue