Skip to main content
PrimerQRCodeScope manages payment methods that display a QR code for the user to scan (e.g., PromptPay, Xfers). The SDK automatically polls for completion after the QR code is displayed.

Declaration

@MainActor
public protocol PrimerQRCodeScope: PrimerPaymentMethodScope where State == PrimerQRCodeState

Properties

PropertyTypeDescription
stateAsyncStream<PrimerQRCodeState>Stream of QR code state changes

Customization

PropertyTypeDescription
screenQRCodeScreenComponent?Full screen replacement. Signature: (any PrimerQRCodeScope) -> any View
This scope inherits start(), cancel(), onBack(), presentationContext, and dismissalMechanism from PrimerPaymentMethodScope. QR code scopes do not use submit() — the payment completes when the user scans the QR code in their banking app.

PrimerQRCodeState

public struct PrimerQRCodeState: Equatable {
  public enum Status: Equatable {
    case loading
    case displaying
    case success
    case failure(String)
  }

  var status: Status
  var paymentMethod: CheckoutPaymentMethod?
  var qrCodeImageData: Data?
}

Flow

PropertyTypeDescription
statusStatusCurrent payment status
paymentMethodCheckoutPaymentMethod?Payment method details
qrCodeImageDataData?QR code image data (PNG). Available when status is .displaying

Payment methods

Payment MethodRegion
PromptPayThailand
XfersThailand

See also

Scopes overview

All available scopes