Opens a form so that the customer can share the contact information.
## Discussion
If the `fields` array contains `pass` and a matching `passTypeIdentifier` ,
it displays the Wallet pass in full screen for the customer to confirm.
- Parameters:
- purpose: An optional enum of pre-defined purpose of the form, for example `.checkIn`.
The `purpose`` parameter supports `.checkIn` and `.receipt`.
- fields: An array of contact field types on the form.
- message: A multi-line message text below the title.
- Returns: ``CustomerEngagement/CustomerInfo`` contact information shared by the customer.
- Throws: ``CustomerEngagementSession/Error`` if the request fails.
Note: The merchant is responsible for obtaining appropriate consent and maintaining
compliant privacy notices for personal information collected through this session.
final func updateStatus(_ status: CustomerEngagement.Status) async throws
Updates the status on the customer's screen.
When there isn't any form, like a sign-up form being displayed, the screen defaults to
``CustomerEngagement/Status/ready`` unless there is a ``CustomerEngagement/ShoppingCart``.
``CustomerEngagement/Status/ready`` resets the default screen from ``CustomerEngagement/ShoppingCart``.
- Parameters:
- status: An enum that defines a fixed status text which includes a title and a subtitle.
- Throws: ``CustomerEngagementSession/Error`` if the request fails.
Opens a form so that the customer can share the contact information for the
purpose of sign-up activity.
- Parameters:
- purpose: An enum of pre-defined purpose of the form for `.membership`,
`.accountCreation`, and `.accountUpdate`. The default is `.membership`.
- fields: An array of contact field types on the form. Only `.emailAddress` and `.phoneNumber` types are supported.
- message: A multi-line message text below the title.
- emailConsent: A consent option to allow or decline promotions and offers over email channel.
- smsConsent: A consent option to allow or decline promotions and offers over SMS channel.
- termsAndConditions: An optional markdown string to display during the sign-up flow.
- Returns: ``CustomerEngagement/SignUp`` contact information shared by the customer.
- Throws: ``CustomerEngagementSession/Error`` if the request fails.
Opens a form so that the customer can share the postal address and additionally
collect email address and phone number.
For example, email and phone number can be used for delivery notification.
- Parameters:
- purpose: An optional enum of pre-defined purpose of the form, for example `.shipping`.
- fields: An array of optional contact field types on the form. Only `.emailAddress` and `.phoneNumber` types are supported.
- message: A multi-line message text below the title.
- Returns: ``CustomerEngagement/Address`` with postal address and contact information shared by the customer.
- Throws: ``CustomerEngagementSession/Error`` if the request fails.
final func requestPayment(for shoppingCartToken: CustomerEngagement.ShoppingCartToken, using paymentRequest: PKPaymentRequest, delegate: any PKPaymentAuthorizationControllerDelegate) async throws -> Bool
Opens a form so a customer can select a payment option.
final func updateShoppingCart(_ shoppingCart: CustomerEngagement.ShoppingCart) async throws -> CustomerEngagement.ShoppingCartToken
Updates the shopping cart on the customer's device.
This function can be called repeatedly as the shopping cart is populated,
and each update replaces the entire shopping cart.
When there isn't any form, like a sign-up form being displayed, the screen defaults to
the current ``CustomerEngagement/ShoppingCart``.
- Parameters:
- shoppingCart: A structure of the shopping cart, consisting of shopping cart items and the summary.
- Returns: ``CustomerEngagement/ShoppingCartToken`` for making payment request using ``requestPayment(for:using:delegate:)``.
- Throws: ``CustomerEngagementSession/Error`` if the request fails.
get · iOS 27.0+
customerConfiguration
TypeScript
get customerConfiguration(): (CustomerEngagementSession_CustomerConfiguration) | null
Swift declaration
final var customerConfiguration: CustomerEngagementSession.CustomerConfiguration? { get }
A structure containing configuration information of the customer device.
The value is available after the ``Event/ready`` event.
final func open(using token: CustomerEngagement.Token? = nil) async throws
Opens the engagement session.
- Parameters:
- token: `The Customer Engagement token used to authenticate your credentials.
If you omit the token, you must have already created a valid ``PaymentCardReaderSession`` before calling this method.
- Throws: ``CustomerEngagementSession/Error`` if the open request fails. This method can also throw ``Foundation/URLError``.
method · iOS 27.0+
close
TypeScript
close(): Promise<void>
Swift declaration
final func close() async throws
Closes the engagement session.
When this device disconnects, any paired device that is still connected receives a notification to close its side of the session.
get · iOS 27.0+
token
TypeScript
get token(): CustomerEngagementSession_Token
Swift declaration
final let token: CustomerEngagementSession.Token
The session token.
This token can be associated with the customer profile and used to
check if the new session is a reconnection of the previous session.
get · iOS 27.0+
events
TypeScript
get events(): SDKHandle
Swift declaration
final let events: any AsyncSequence<CustomerEngagementSession.Event, Never>
An asynchronous sequence of events that occur during the engagement session.
method · iOS 27.0+
addPass
TypeScript
addPass(pass: ArrayBuffer): Promise<boolean>
Swift declaration
final func addPass(_ pass: Data) async throws -> Bool
Asks the customer to confirm adding a Pass to Wallet.
- Parameters:
- pass: Properly created `.pkpass` data to be added to Wallet.
The `passTypeIdentifier` of the pass must be one of the identifiers in the
``CustomerEngagementSession/Configuration/passTypeIdentifiers``.
- Returns: `true` if the pass is added to Wallet successfully or the same pass already exists; `false` if the customer declines.
- Throws: ``CustomerEngagementSession/Error`` if the request fails.