Documentation Index Fetch the complete documentation index at: https://primer.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
PrimerKlarnaScope manages the Klarna multi-step payment flow: category selection, authorization, and finalization.
Declaration
@MainActor
public protocol PrimerKlarnaScope : PrimerPaymentMethodScope where State == PrimerKlarnaState
Properties
Property Type Description stateAsyncStream<PrimerKlarnaState>Stream of Klarna state changes presentationContextPresentationContext.direct or .fromPaymentSelectiondismissalMechanism[DismissalMechanism]Supported dismissal methods paymentViewUIView?Klarna’s native payment view
Customization
Property Type Description screenKlarnaScreenComponent?Full screen replacement. Signature: (any PrimerKlarnaScope) -> any View authorizeButtonKlarnaButtonComponent?Custom authorize button. Signature: (any PrimerKlarnaScope) -> any View finalizeButtonKlarnaButtonComponent?Custom finalize button. Signature: (any PrimerKlarnaScope) -> any View
Methods
Method Description selectPaymentCategory(_ categoryId: String)Select a Klarna payment category authorizePayment()Start the authorization step finalizePayment()Complete the finalization step onBack()Navigate back cancel()Cancel the Klarna flow
PrimerKlarnaState
public struct PrimerKlarnaState : Equatable {
public enum Step : Equatable {
case loading
case categorySelection
case viewReady
case authorizationStarted
case awaitingFinalization
}
var step: Step
var categories: [KlarnaPaymentCategory]
var selectedCategoryId: String ?
}
Flow
Property Type Description stepStepCurrent step in the flow categories[KlarnaPaymentCategory]Available Klarna categories selectedCategoryIdString?Currently selected category
See also
Scopes overview All available scopes