One Logo Pool Ball
ProximityReader · IOS API REFERENCE

PaymentCardReader

class · iOS 15.4+ · SDK 27.1

class PaymentCardReader

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.

Members (13)

method · iOS 18.4+

fetchPaymentCardReaderStore

TypeScript
fetchPaymentCardReaderStore(): PaymentCardReaderStore
Swift declaration
func fetchPaymentCardReaderStore() throws -> PaymentCardReaderStore

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.

method · iOS 15.4+

linkAccount

TypeScript
linkAccount(token: PaymentCardReader_Token): Promise<void>
Swift declaration
func linkAccount(using token: PaymentCardReader.Token) async throws

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.

method · iOS 16.1+

relinkAccount

TypeScript
relinkAccount(token: PaymentCardReader_Token): Promise<void>
Swift declaration
func relinkAccount(using token: PaymentCardReader.Token) async throws

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``.

method · iOS 16.4+

isAccountLinked

TypeScript
isAccountLinked(token: PaymentCardReader_Token): Promise<boolean>
Swift declaration
func isAccountLinked(using token: PaymentCardReader.Token) async throws -> Bool

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``.

method · iOS 18.4+

prepareStoreAndForward

TypeScript
prepareStoreAndForward(): Promise<StoreAndForwardPaymentCardReaderSession>
Swift declaration
func prepareStoreAndForward() async throws -> StoreAndForwardPaymentCardReaderSession

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.

init · iOS 15.4+

init

TypeScript
static init(options?: PaymentCardReader_Options): PaymentCardReader
Swift declaration
init(options: PaymentCardReader.Options = .init())

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.

method · iOS 15.4+ · Deprecated in iOS 16.0

prepare

TypeScript
prepareUsingUpdateHandler(token: PaymentCardReader_Token, updateHandler?: (((arg0: PaymentCardReader_UpdateEvent) => void)) | null): Promise<PaymentCardReaderSession>
Swift declaration
func prepare(using token: PaymentCardReader.Token, updateHandler: ((PaymentCardReader.UpdateEvent) -> Void)?) async throws -> PaymentCardReaderSession

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.

method · iOS 16.0+

prepare

TypeScript
prepareUsing(token: PaymentCardReader_Token): Promise<PaymentCardReaderSession>
Swift declaration
func prepare(using token: PaymentCardReader.Token) async throws -> PaymentCardReaderSession

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.

Skipped declarations

No declarations were skipped in this snapshot.

All ProximityReader types →