Android / Hybrid Approach
Integration guide for how to integrate Klarna Checkout in your Android app, using the Hybrid approach.
The components in the Hybrid approach are
- An integration of Klarna Checkout from your servers to Klarna's servers
- A web page 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 your web page with Klarna Checkout integrated
You will need Klarna Checkout integrated on a web page on your server. This integration guide will not go through the Klarna Checkout integration in detail, but assumes it has been set up already. If needed, you can learn how to do it in the regular Klarna Checkout Integration guide here.
Step 4. Initialize SDK with your WebView
Initialize the SDK with your web view. You first create a KlarnaCheckout object, and set the web view to this object.
Step 5. Present your web page
From the web view, load the URL to the web page where you have integrated Klarna Checkout.
Step 6. Configure event listeners
To handle the signals received from the SDK you should set up an observer listening to the KCOSignalNotification. To make sure the checkout shows the succesful screen you need to redirect your webview to the completion url upon recieveing the complete message.
You may also 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