Klarna's Flutter wrapper for the In-App SDK
Looking for the pure native Klarna In-App SDK? Check out the Klarna In-App SDK repo instead.
Looking for the React Native Klarna In-App SDK? Check out the React Native Klarna In-App SDK repo instead.
- iOS 9 or later.
- Android 4.4 or later.
Add flutter_klarna_inapp_sdk
as a dependency in your pubspec.yaml
file according to the official documentation.
Name | Type | Description |
---|---|---|
returnUrl | String |
An app-defined URL scheme the component uses to return customers to your app. |
Initializes new WebView
and javascript Klarna Post Purchase Experience library.
Name | Type | Description |
---|---|---|
locale | String |
A string representing the user locale. For example: se-SE |
purchaseCountry | String |
A string representing the purchase country. For example: SE |
design | named optional String? |
A string representing the design ID. |
environment | named optional KlarnaPostPurchaseEnvironment? |
Region or playground environment for Post Purchase SDK. |
Destroys any object, including WebView
attached to the client.
Load the Klarna widget for the operation.
Name | Type | Description |
---|---|---|
locale | named optional String? |
A string representing the user locale. |
operationToken | String |
The operation token for the related order returned from the post purchase api. |
Called to kick off the oauth flow.
Name | Type | Description |
---|---|---|
locale | named optional String? |
A string representing the user locale. |
clientId | String |
The client_id for your application. |
scope | String |
A space-delimited list of scopes that identify the resources that your application could access on the user's behalf. These values define the consent screen that Klarna displays to the user. |
redirectUri | String |
The “location” where the OAuth server redirects the user after the user completes the authorization flow. The value must exactly match one of the redirect_url values provided to Klarna in advance. |
state | named optional String? |
A string value that your application uses to maintain state between your authorization request and the authorization server's response. The Authorization server returns the exact value that you send to the redirect_url as a URL parameter. |
loginHint | named optional String? |
If your application knows which user is trying to authenticate, it can use this parameter to provide a hint to the Klarna’s Authorization Server. The server uses the hint to simplify the login flow by prefilling the email field in the sign-in form. It’s recommended to use this as it will improve the customer experience. |
responseType | named optional String? |
The desired grant type. The value MUST be one of "code" for requesting an authorization code or "token" for requesting an access token (implicit grant). The default is "code" |
After cloning the repository run the command below to setup the project.
flutter packages get
- Execute
cd example; flutter build apk
- Import the
example/android/build.gradle
file or openexample/android
folder from Android Studio.
Plugin implementation will be located at flutter_klarna_inapp_sdk/java/com.klarna.inapp.sdk.flutter_klarna_inapp_sdk/
.
- Execute
cd example; flutter build ios --no-codesign
- Import the
example/ios/Runner.xcworkspace
file from XCode.
Plugin implementation will be located at Pods/Development Pods/flutter_klarna_inapp_sdk/../../example/ios/.symlinks/plugins/flutter_klarna_inapp_sdk/ios/Classes
.