Create a session and start Headless Universal Checkout with its clientToken and your custom settings. Once the session is configured on the SDK the completion handler will be called.

1234567
func start(    withClientToken clientToken: String,    settings: PrimerSettings? = nil,    delegate: PrimerHeadlessUniversalCheckoutDelegate? = nil,    uiDelegate: PrimerHeadlessUniversalCheckoutUIDelegate? = nil,    completion: @escaping (_ paymentMethods: [PrimerHeadlessUniversalCheckout.PaymentMethod]?, _ err: Error?) -> Void)
swift
copy

Parameters

clientToken
StringRequired

Client token as returned by the create client session call

settings
PrimerSettingsOptional
properties
paymentHandling
enum PrimerPaymentHandling

Use this to set you payment handling flow. Defaults to .auto.

cases
auto
default
Primer SDK will create the payment and handle the flow.

If you use the manual flow, make sure you add the primerDidTokenizePaymentMethod(_:decisionHandler:) delegate function of PrimerDelegate, create a payment on your backend and call the decisionHandler of the delegate function once you receive your backend\'s response.

localeData
PrimerLocaleData
Forces some payment methods' locale.
properties
languageCode
StringRequired

Forces the language code (e.g. en). Defaults on your app's language code if available.

Forces the language code (e.g. US). Defaults on your app's region code if available.

paymentMethodOptions
PrimerPaymentMethodOptions
properties
urlScheme
String

⚠️ Required for some payment methods (e.g. PayPal).

This option sets the deeplink schema used when redirecting back from 3rd party applications to your app.

applePayOptions
PrimerApplePayOptions

⚠️ Required when using Apple Pay in your integration.

properties
merchantIdentifier
StringRequired
Set it to the merchant identifier as it is shown in your Apple Pay certificate.
merchantName
StringDeprecated

Set it to the merchant name that you want to be shown on the Apple Pay screen. Deprecated, use ClientSession instead.

Defaults to false. Set to true to let Apple Pay capture the customer's billing address.

Deprecated: Use BillingOptions to configure required billing fields.

If in some cases you don't want to present ApplePay option if the device is not supporting it set this to false. The default value is true.

Default value is `true`. Set to `false` if you do not want to present Apple Pay option on unsupported devices.

Flag introduced to enable the initiation of the ApplePay flow even when no cards are present in the Wallet. To enable the feature, set this to false. The default value true.

Default value is `true`. This flag supports the old behavior where Apple Pay flow might not present if there are no cards in the Wallet.
shippingOptions
ShippingOptions
Configure shipping options for Apple Pay.
properties
shippingContactFields
Array of RequiredContactField
Specify which contact fields are required for shipping.
Indicate if a shipping method is required.
billingOptions
BillingOptions
Configure billing options for Apple Pay.
properties
requiredBillingContactFields
Array of RequiredContactField
Specify which contact fields are required for billing.
klarnaOptions
PrimerKlarnaOptions

⚠️ Required when using Klarna in your integration.

properties
Set the payment description that will be shown on the Klarna screen.
threeDsOptions
PrimerThreeDsOptions
properties

Set the iOS Universal Link that's used to call your app after an out-of-band (OOB) authentication. Supported in 3D Secure protocol versions 2.2.0 and after.

stripeOptions
PrimerStripeOptions
⚠️ Required when using Stripe ACH in your integration.
Properties
mandateData
MandateData?

One of:

The full text that you would like to be displayed to the user before they accept/decline the mandate.

A merchantName that will be used as part of our predefined mandate template.

uiOptions
PrimerUIOptions

Set the uiOptions for custom UI options of the Primer SDK.

properties

Set to false to hide the loading screen before the Universal Checkout or the Vault Manager. Defaults to true.

Set to false to hide the screen after a successful payment, or tokenization on the vault flow. Defaults to true.

Set to false to hide the error screen when an error occurs. Defaults to true.

dismissalMechanism
enum DismissalMechanism

Set the mechanism for dismissing Universal Checkout. Options are:

  • gestures: The dialog can be dismissed by tapping outside or by swiping down.
  • closeButton: A close button is provided, allowing users to dismiss the dialog manually.
theme
PrimerTheme
Set a custom theme for Primer SDK.
debugOptions
PrimerDebugOptions
properties
clientSessionCachingEnabled
BoolDefault: false
Before enabling the flag to true it's recommended to reach out to Primer support for additional verification since there are edge cases where it's not advised.

Indicates whether client session caching is enabled.

When set to true, responses from the server will be cached on the client side, allowing for faster subsequent access to the same data within the cache duration. When set to false, every request to the server will be processed without utilizing any client-side cache, ensuring that the client always receives the most up-to-date data.

delegate
PrimerHeadlessUniversalCheckoutDelegateOptional
Set the delegate to receive updates of the checkout lifecycle.
uiDelegate
PrimerHeadlessUniversalCheckoutUIDelegateOptional
Set the UI delegate to receive UI updates.
completion
(_ paymentMethods: [PrimerHeadlessUniversalCheckout.PaymentMethod]?, _ err: Error?) -> VoidOptional
The completion handler will be called once the session has been configured on the SDK, and it will provide you with available payment methods for the session