Integrate On-site messaging into your native iOS or Android app with Klarna's Mobile SDK to improve transparency and conversion for your Partners. The integration also covers the pre-qualification feature, which lets customers check their eligibility for Klarna financing before initiating a Payment Request — reducing friction and increasing confidence by making available options clear upfront.
The first step to add On-site messaging to your application is to initialize the Klarna SDK with the required configuration.
SWIFT
1
2
3
4
5
6
7
8
9
10
// Optional: set up the acquirer configuration to specify the Payment Account.// Create an instance of KlarnaAcquiringConfig.let acquiringConfig = KlarnaAcquiringConfig(
paymentAcquiringAccountId: paymentAcquiringAccountId,
paymentAccountReference: paymentAccountReference
)
// Create an instance of KlarnaConfiguration.let configuration = KlarnaConfiguration(
clientId: clientId,
Required only when you are an Acquiring Partner with multiple Payment Accounts. Include this block to specify which Payment Account the SDK should use.
Name
Type
Presence
Description
paymentAcquiringAccountId
String
Required
Unique account identifier assigned by Klarna to the Acquiring Account.
paymentAccountReference
String
Required
A unique string reference for the Payment Account, used by you to identify the Payment Account without relying on Klarna-generated IDs. Used to identify the Partner Account on your side.
The client ID of the Partner Account that is integrating the Mobile SDK. When you, as the Acquiring Partner, are the integrator, set this to your own client ID.
accountId
String
Optional
Identifier of the account the action is performed on behalf of.
locale
String
Optional
Default locale (ISO 3166-1 alpha-2) for the SDK. The system default locale is used if not set.
acquiringConfig
Object
Optional
Required if you are an Acquiring Partner with multiple Payment Accounts — see KlarnaAcquiringConfig for the fields it must contain.
klarnaNetworkSessionToken
String
Optional
A Klarna network session token. Allows the SDK to be initialized with an existing session.
The On-site messaging native view is KlarnaMessagingPlacementView. Create it programmatically and add it to your layout with your desired layout options.
SWIFT
1
2
3
4
5
6
7
8
9
10
// Create an instance of KlarnaMessagingPlacementConfiguration.// Depending on your requirements, use the `CreditPromotionBadge`// or `CreditPromotionAutoSize` configuration.let placementConfiguration = KlarnaMessagingPlacementConfiguration.creditPromotionBadge(
theme: .automatic,
amount: 10000,
currency: "USD"
)
// Create an instance of the view.