An object you use to configure Tap to Pay on iPhone on the current device.
A `PaymentCardReader` object coordinates the reading of payment and loyalty
cards using existing iPhone hardware. Use it to read cards that
might otherwise require specialized hardware. For example, use it to collect
contactless payment information from another iPhone or from NFC-enabled hardware,
such as NFC-enabled plastic cards.
After you create the `PaymentCardReader` object, call ``prepare(using:)``
to validate the payment pipeline and receive a new ``PaymentCardReaderSession``.
Use the session object to read card information related to payments and refunds,
or to verify card information.
Returns a store containing the read results the framework obtained using a Store and Forward
session.
- Returns: ``PaymentCardReaderStore`` when successful.
- Throws: ``PaymentCardReaderError`` if the method fails to retrieve the store.
get · iOS 15.4+
isSupported
TypeScript
static get isSupported(): boolean
Swift declaration
static let isSupported: Bool
A Boolean value that indicates whether this device model supports Tap to Pay on iPhone.
For this property to be `true`, the device model must be iPhone XS or newer.
This property doesn't check the OS version.
Presents a sheet for the merchant to accept Tap to Pay on iPhone’s Terms and Conditions on a device.
To use Tap to Pay on iPhone, your participating payment service provider must provide the merchant using your app with a secure token.
This token contains an unique identifier for each merchant.
This merchant must accept Tap to Pay on iPhone’s Terms and Conditions.
After a merchant accepts the Terms and Conditions for their specific merchant identifier on one device,
they don’t need to accept it again on additional devices that use the same identifier.
Use the ``isAccountLinked(using:)`` method to confirm calling ``linkAccount(using:)`` is required.
If the merchant hasn't accepted the Terms and Conditions, calling
``PaymentCardReader/prepare(using:)`` throws ``PaymentCardReaderError/accountNotLinked``.
If the merchant has already accepted the Terms and Conditions, calling
this method throws ``PaymentCardReaderError/accountAlreadyLinked``.
- Parameters:
- token: The token from your payment service provider. This token contains the
merchant identifier.
- throws: ``PaymentCardReaderError/accountAlreadyLinked`` if the merchant already
accepted the Tap to Pay on iPhone’s Terms and Conditions. The method throws
``PaymentCardReaderError/accountLinkingFailed``,
``PaymentCardReaderError/accountLinkingCancelled``,
or other relevant errors in ``PaymentCardReaderError`` if a problem occurs.
Presents a sheet for the merchant to re-accept Tap to Pay on iPhone’s Terms and Conditions on a device using a different Apple Account.
To use Tap to Pay on iPhone, your participating payment service provider must provide the merchant using your app with a secure token.
This token contains a unique identifier for each merchant and also specifies if relinking using a different Apple Account is allowed.
To use this method, a merchant must have already accepted the Terms and Conditions using ``PaymentCardReader/linkAccount(using:)``.
After a merchant accepts the Terms and Conditions for their specific merchant identifier on one device,
they don’t need to accept it again on additional devices that use the same identifier.
- Parameters:
- token: The token from your payment service provider. This token contains the merchant identifier and must include permission for relinking.
- throws: ``PaymentCardReaderError/accountLinkingFailed``, ``PaymentCardReaderError/accountLinkingCancelled``,
or other relevant errors in ``PaymentCardReaderError``.
A Boolean value that indicates whether the account is already linked.
Call ``linkAccount(using:)`` to link an account.
> Note: If ``PaymentCardReader/prepare(using:)`` throws an ``PaymentCardReaderError/accountNotLinked`` error
call ``linkAccount(using:)`` again to relink the account.
- Parameters:
- token: The token from your payment service provider. This token contains the merchant identifier.
- throws: ``PaymentCardReaderError``
get · iOS 15.4+
readerIdentifier
TypeScript
get readerIdentifier(): Promise<string>
Swift declaration
var readerIdentifier: String { get async throws }
The unique identifier for this card reader.
Include this identifier in support requests or tracing incidents to help
track down potential problems. If the identifier isn't readable,
getting this value throws a ``PaymentCardReaderError``.
Configures the pipeline for reading payment or loyalty cards in Store and Forward mode.
Call this function to configure Tap to Pay on iPhone on someone's device.
This method verifies that the device is able to read contactless cards and is
properly configured to process reads in Store and Forward mode.
Prior to calling this method, make sure that your service provider has the Store and
Forward feature enabled and that you created an online session in the last 24 hours.
- Returns: ``StoreAndForwardPaymentCardReaderSession`` when successful.
- Throws: ``PaymentCardReaderError`` if the method fails to configure the device.
get · iOS 15.4+ · Deprecated in iOS 16.0
id
TypeScript
get id(): string
Swift declaration
final let id: String
A unique identifier for this object.
get · iOS 16.0+
events
TypeScript
get events(): SDKSequence<PaymentCardReader_Event>
Swift declaration
final let events: AsyncStream<PaymentCardReader.Event>
A stream of events you receive indicating the activities of the payment card reader.
When calling ``prepare(using:)``, the ``Event/updateProgress(_:)`` event will indicate the completion percentage of the configuration.
When reading cards with ``PaymentCardReaderSession``, the raised events will indicate the current state of the card-reading process.
Creates a payment card reader with the specified options.
- Parameters:
- options: The configuration settings for the reader.
Keep a strong reference to the returned object for the duration of the
reader session.
get · iOS 18.0+
options
TypeScript
get options(): PaymentCardReader_Options
Swift declaration
final let options: PaymentCardReader.Options
The defined configuration settings when the reader was created.
Configures the pipeline for reading payment or loyalty cards.
Call this function to configure Tap to Pay on iPhone on someone's device.
This method verifies that the device is able to read contactless cards and is
properly configured to process transactions.
Upon successful configuration of the device, this method returns a
``PaymentCardReaderSession`` object, which you use to read card information.
The session remains active while your app is in the foreground. If you
release the returned session, call this method again before you start
any new read operations.
After calling this method, there are four possible scenarios:
- The method returns an existing ``PaymentCardReaderSession`` immediately
if that session is still valid.
- The method retrieves and returns a new ``PaymentCardReaderSession`` from
the server if the device is fully configured.
- The method updates the device's configuration and delivers progress
updates to the provided `updateHandler`. Upon completion, the method returns a new
``PaymentCardReaderSession`` for the updated configuration. This process
can take anywhere from a few seconds to several minutes.
- This method throws a ``PaymentCardReaderError`` if a problem occurs.
- Parameters:
- token: Valid and signed token from a participating payment service provider.
- updateHandler: Returns configuration progress or session state change.
- returns: ``PaymentCardReaderSession`` when successful.
- throws: ``PaymentCardReaderError`` if the method fails to configure the device.
Configures the pipeline for reading payment or loyalty cards.
Call this function to configure Tap to Pay on iPhone on someone's device.
This method verifies that the device is able to read contactless cards and is
properly configured to process transactions.
Upon successful configuration of the device, this method returns a
``PaymentCardReaderSession`` object, which you use to read card information.
The session remains active while your app is in the foreground. If you
release the returned session, call this method again before you start
any new read operations.
After calling this method, there are four possible scenarios:
- The method returns an existing ``PaymentCardReaderSession`` immediately
if that session is still valid.
- The method retrieves and returns a new ``PaymentCardReaderSession`` from
the server if the device is fully configured.
- The method updates the device's configuration and delivers progress
updates to the ``PaymentCardReader/events`` attribute. Upon completion, the method returns a new
``PaymentCardReaderSession`` for the updated configuration. This process
can take anywhere from a few seconds to several minutes.
- This method throws a ``PaymentCardReaderError`` if a problem occurs.
- Parameters:
- token: Valid and signed token from a participating payment service provider.
- returns: ``PaymentCardReaderSession`` when successful.
- throws: ``PaymentCardReaderError`` if the method fails to configure the device.