Skip to main content
PrimerKlarnaScope manages the Klarna multi-step payment flow: category selection, authorization, and finalization.

Declaration

@MainActor
public protocol PrimerKlarnaScope: PrimerPaymentMethodScope where State == PrimerKlarnaState

Properties

PropertyTypeDescription
stateAsyncStream<PrimerKlarnaState>Stream of Klarna state changes
presentationContextPresentationContext.direct or .fromPaymentSelection
dismissalMechanism[DismissalMechanism]Supported dismissal methods
paymentViewUIView?Klarna’s native payment view

Customization

PropertyTypeDescription
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

MethodDescription
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

PropertyTypeDescription
stepStepCurrent step in the flow
categories[KlarnaPaymentCategory]Available Klarna categories
selectedCategoryIdString?Currently selected category

See also

Scopes overview

All available scopes