ContactlessPaymentSession

public final actor ContactlessPaymentSession

Class to manage and perform contactless payment transaction.

Since

7.0.0
  • Constructor to initialize ContactlessPaymentSession.

    Declaration

    Swift

    public convenience init()
  • requestAuthorization() Asynchronous

    Request authorization from user to allow NFC usage.

    This prompts the permission dialog during first time application launch. On subsequent call, this API check the current authorization granted by end user.

    When end user allows the authorization, the application is shown in list of default contactless application. Otherwise, application is not shown in the list.

    Throws:

    Declaration

    Swift

    @available(iOS 17.4, *)
    public func requestAuthorization() async throws
  • startEmulation() Asynchronous

    Start the card emulation and presents a modal user interface to user.

    This API is available after authenticationCompleted. Developer could call this API on authenticationCompleted or posConnected, depending on the user experience preferred. After this API is called, a modal user presentation is shown, i.e. no further UI modification, except the setAlertMessage(_:).

    Throws:

    Declaration

    Swift

    @available(iOS 17.4, *)
    nonisolated public func startEmulation() async throws
  • Start contactless payment transaction.

    The digital card ID provided will be remained as default card at the end of the payment

    Application should call eventStream to handle each event.

    Declaration

    Swift

    @available(iOS 17.4, *)
    public func startPayment(withDigitalCardID digitalCardID: String? = nil) async

    Parameters

    digitalCardID

    Digital card ID used. Otherwise, it use default card.

  • cancel() Asynchronous

    Cancel ongoing contactless payment transaction.

    Declaration

    Swift

    @available(iOS 17.4, *)
    public func cancel() async
  • An asynchronous sequence of events from contactless payment transaction.

    Declaration

    Swift

    public var eventStream: AsyncStream<Event>
  • setAlertMessage(_:) Asynchronous

    A message to show on the NFC action sheet.

    Application should set the message for following events:

    Declaration

    Swift

    @available(iOS 17.4, *)
    nonisolated public func setAlertMessage(_ alertMessage: String) async
  • The device eligibility whether it supports contactless payment.

    See more

    Declaration

    Swift

    public enum Eligibility : Sendable
  • Errors encounterd for contactless payment session.

    See more

    Declaration

    Swift

    public enum Error : Swift.Error
  • Events produced during contactless payment session.

    See more

    Declaration

    Swift

    public enum Event : Sendable
  • Struct to manage the authentication flow.

    See more

    Declaration

    Swift

    public struct AuthenticateAction : Sendable