iOS SDK
- Installation
- Primer
- PrimerHeadlessUniversalCheckout
- Properties
- Methods
- Delegates
- Assets manager
- Native UI manager
- Raw data manager
- Raw data manager delegate
- NOL pay manager
- Component with redirect manager
- Klarna headless manager
- ACH headless manager
- Vault manager
- Common objects
provideKlarnaComponent
This method allows you get an instance of KlarnaComponent
to manage payments for Klarna.
public func provideKlarnaComponent(with intent: PrimerSessionIntent) throws -> (any KlarnaComponent)? { }
Parameters
Hide Parameters
Hide Parameters
Returns
An instance of KlarnaComponent
.
Hide KlarnaComponent
Hide KlarnaComponent
The Data associated type
Show enum KlarnaCollectableData
Show enum KlarnaCollectableData
Enum member representing the payment category.
Hide Properties
Hide Properties
Payment category required for session creation.
Show child attributes
Show child attributes
Show Properties
Show Properties
ID of the payment method category to be used while loading the payment view. The possible values are:
- klarna
- pay_later
- pay_now
- pay_over_time
- direct_bank_transfer
- direct_debit
Name of the payment method category. These names are dynamic depending on what payment method is in the category.
URL of the descriptive asset. Using this dynamic asset will make sure that changes from Klarna be automatically propagated.
URL of the stadard asset. Using this dynamic asset will make sure that changes from Klarna be automatically propagated.
The client token used for validation purpose.
Enum member representing finalizing the Klarna payment.
The Step associated type
Show enum KlarnaStep
Show enum KlarnaStep
Indicates a successful creation of a payment session. It caries clientToken
string, which is used for validation purposes and paymentCategories
of type KlarnaPaymentCategory
, representing the available payment options for the user.
Hide Properties
Hide Properties
The list of available Klarna payment categories.
Show child attributes
Show child attributes
Show Properties
Show Properties
ID of the payment method category to be used while loading the payment view. The possible values are:
- klarna
- pay_later
- pay_now
- pay_over_time
- direct_bank_transfer
- direct_debit
Name of the payment method category. These names are dynamic depending on what payment method is in the category.
URL of the descriptive asset. Using this dynamic asset will make sure that changes from Klarna be automatically propagated.
URL of the stadard asset. Using this dynamic asset will make sure that changes from Klarna be automatically propagated.
Indicates that the Klarna view has been initialized. This is the first step in the Klarna view handling process.
Represents a change in the view’s height, which may occur when the Klarna view adjusts to display different content. The height
parameter specifies the new height of the view.
Indicates that the Klarna view has finished loading its initial content and is ready for interaction. The view
parameter represents the klarna view.
Indicates that the payment session has been successfully authorized. It carries an authToken
string for subsequent operations that require authorization and checkoutData
for showing the checkout results, after the merchant finishes the payment.
Signals that the payment session requires finalization step in order to be completed.
Indicates that the payment session has been finalized. It carries an authToken
string for subsequent operations that require authorization and checkoutData
for showing the checkout results, after the merchant finishes the payment.
Initialize the component by calling the start function. This method should be called only once.
Call submit
function in order to process collected data and move component to next state.
Error delegate will be triggered every time an error is thrown in the process.
func didReceiveError(error: PrimerError)
Validation delegate will be triggered every time collected data is updated.
func didUpdate(validationStatus: PrimerValidationStatus, for data: PrimerCollectableData?)
PrimerValidationStatus
is an enum that represents the different validation statuses in the Primer SDK. It helps to communicate the state of validation for a particular process, providing clear categorization of validation states.
Hide enum PrimerValidationStatus
Hide enum PrimerValidationStatus
Enum case representing the ongoing validation state. This indicates that the validation process is currently in progress.
Enum case representing a successful validation state. This indicates that the validation process has completed successfully and the data is valid.
Enum case representing an unsuccessful validation state due to validation errors. This indicates that the validation process has completed but has found one or more errors in the data.
Hide Associated Value
Hide Associated Value
An array of PrimerValidationError
representing the specific validation errors found.
Whenever start or submit methods are
called, stepDelegate
will trigger the next step in case the call to the mentioned method was successful.
In the case of KLARNA, the steps will be of type KlarnaStep
.
KlarnaStep
is an enum holding different output data for specific steps.
Show enum KlarnaStep
Show enum KlarnaStep
Indicates a successful creation of a payment session. It caries clientToken
string, which is used for validation purposes and paymentCategories
of type KlarnaPaymentCategory
, representing the available payment options for the user.
Hide Properties
Hide Properties
The list of available Klarna payment categories.
Show child attributes
Show child attributes
Show Properties
Show Properties
ID of the payment method category to be used while loading the payment view. The possible values are:
- klarna
- pay_later
- pay_now
- pay_over_time
- direct_bank_transfer
- direct_debit
Name of the payment method category. These names are dynamic depending on what payment method is in the category.
URL of the descriptive asset. Using this dynamic asset will make sure that changes from Klarna be automatically propagated.
URL of the stadard asset. Using this dynamic asset will make sure that changes from Klarna be automatically propagated.
Indicates that the Klarna view has been initialized. This is the first step in the Klarna view handling process.
Represents a change in the view’s height, which may occur when the Klarna view adjusts to display different content. The height
parameter specifies the new height of the view.
Indicates that the Klarna view has finished loading its initial content and is ready for interaction. The view
parameter represents the klarna view.
Indicates that the payment session has been successfully authorized. It carries an authToken
string for subsequent operations that require authorization and checkoutData
for showing the checkout results, after the merchant finishes the payment.
Signals that the payment session requires finalization step in order to be completed.
Indicates that the payment session has been finalized. It carries an authToken
string for subsequent operations that require authorization and checkoutData
for showing the checkout results, after the merchant finishes the payment.
Example:
func didReceiveStep(step: KlarnaStep)
Update component with collected data by passing an enum representing collectable data. This method can be called at any point, even if you have only partially collected data. To validate the partially collected data, you can refer to the validationDelegate.
In case of KLARNA, the Data will be of type KlarnaCollectableData
.
Show enum KlarnaCollectableData
Show enum KlarnaCollectableData
Enum member representing the payment category.
Hide Properties
Hide Properties
Payment category required for session creation.
Show child attributes
Show child attributes
Show Properties
Show Properties
ID of the payment method category to be used while loading the payment view. The possible values are:
- klarna
- pay_later
- pay_now
- pay_over_time
- direct_bank_transfer
- direct_debit
Name of the payment method category. These names are dynamic depending on what payment method is in the category.
URL of the descriptive asset. Using this dynamic asset will make sure that changes from Klarna be automatically propagated.
URL of the stadard asset. Using this dynamic asset will make sure that changes from Klarna be automatically propagated.
The client token used for validation purpose.
Enum member representing finalizing the Klarna payment.
Example:
func updateCollectedData(collectableData: KlarnaCollectableData)
Example
do {
manager = PrimerHeadlessUniversalCheckout.KlarnaManager()
klarnaComponent = try manager.provideKlarnaComponent(with: sessionIntent)
} catch {
// Catch errors here
}