Also, if you’re using Java, add compile options to support Java version 1.8 in the app's build.gradle:
Standalone Integration
Initialization Steps
Before:
In the legacy Klarna Checkout SDK, you need to create an instance of the SDK, get the view object from the SDK instance, and manually add it to your view hierarchy:
After:
In the Klarna Mobile SDK, you can either create the KlarnaCheckoutView in your XML file and get a reference to it, or you can create an instance programmatically, add it to your view hierarchy, and set its properties.
Via XML:
Via code:
Setting the Return URL
Before:
In the legacy Klarna Checkout SDK, you provide the return URL value in the constructor:
After:
In the Klarna Mobile SDK, you can either set the returl URL value as an XML attribute:
or provide it directly in the constructor:
Handling Signals/Events
Before:
In the legacy Klarna Checkout SDK, you would set a `SignalListener` object on the Checkout to listen to the different events:
After:
In the Klarna Mobile SDK, you need to provide a `KlarnaEventHandler` object in the constructor or set this property on the Checkout SDK to listen to events and error messages:
Setting the HTML Snippet
In both SDKs, you need to call the same `setSnippet` function:
Suspend and Resume the Checkout
In both SDKs, you need to call the same `resume` and `suspend` functions:
Handling External Payment Methods
Before:
In the legacy Klarna Checkout SDK, you need to set a boolean flag on the checkout instance to configure if you want to handle external payment methods or not:
Then you would receive the corresponding signal in your `signalListener` callback:
After:
In the Klarna Mobile SDK, you need to access and set this flag inside a new property called `checkoutOptions`:
Then you would receive the corresponding signal in your `klarnaEventHandler` callback:
Handling Validation Errors
Before:
In the legacy Klarna Checkout SDK, you need to set a boolean flag on the checkout instance to configure if you want to handle validation errors or not:
Then you would receive the corresponding signal in your `signalListener` callback:
After:
In the Klarna Mobile SDK, you need to access and set this flag inside a new property called `checkoutOptions`:
Then you would receive the corresponding signal in your `klarnaEventHandler` callback:
Hybrid Integration
Before:
In the legacy Klarna Checkout SDK, you needed to create an instance of `KlarnaCheckout` and then set your `WebView` object to the SDK. Then you could load your Klarna Checkout integration in a URL via this `WebView`:
After:
In the Klarna Mobile SDK, you need to create an instance of `KlarnaHybridSDK` and then set your `WebView` object to the SDK. Then you could load your Klarna Checkout integration in a URL via this `WebView`:
You would also need to notify the SDK whenever a new page is loaded:
To know more about the Hybrid integration using Klarna Mobile SDK and the callbacks, please take a look at this page.