Contents

readPaymentCard(_:vasRequest:stopOnVASResult:eventHandler:)

Presents a sheet to read both contactless payments and loyalty cards for a purchase or refund, and returns the relevant card data.

Declaration

func readPaymentCard(_ request: PaymentCardTransactionRequest, vasRequest: VASRequest, stopOnVASResult: Bool, eventHandler: ((PaymentCardReaderSession.Event) -> Void)? = nil) async throws -> (PaymentCardReadResult?, VASReadResult?)

Parameters

  • request:

    The transaction object you provide with the payment amount and currency details.

  • vasRequest:

    The object that you use to specify the loyalty card request details, such as the list of supported merchants.

  • stopOnVASResult:

    A Boolean that indicates what type of result to return. See the discussion for details of how this parameter affects the return value.

  • eventHandler:

    A handler you use to receive request-related updates. The handler handler has no return value and takes a Event as a parameter. Use the event parameter to determine what happened.

Return Value

Either PaymentCardReadResult, VASReadResult, or both when the read operation was successful.

Discussion

Call this method to read either a contactless payment card or a loyalty card. This method displays a system sheet with instructions on what the person needs to do. The system UI remains onscreen until the system reads the person’s card, you cancel the operation, or an error occurs. If it reads a card successfully, the method returns the card information as a result.

When the stopOnVasResult parameter is true:

  • If the customer taps their loyalty card while the UI is present, the system closes the sheet and returns VASReadResult as a result.

  • If the customer taps their payment card while the UI is present, the system closes the sheet and returns PaymentCardReadResult as a result.

When the stopOnVasResult parameter is false:

  • If the customer taps their Apple Pay Wallet, containing both a relevant loyalty card and a payment card, the system closes the sheet and returns both PaymentCardReadResult and VASReadResult as a result.

  • If the customer taps their Apple Pay Wallet, containing only a relevant loyalty card, the system closes the sheet and returns VASReadResult as a result.

  • If the customer taps their payment card, the system closes the sheet and returns PaymentCardReadResult as a result.

See Also

Deprecated