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

clientTokenStringRequired

Client token as returned by the create client session call

settingsPrimerSettingsOptional

properties

paymentHandlingenum PrimerPaymentHandling

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

cases

autodefault

Primer SDK will create the payment and handle the flow.

manual

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.

localeDataPrimerLocaleData

Forces some payment methods' locale.
properties

languageCodeStringRequired

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

regionCodeString

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

paymentMethodOptionsPrimerPaymentMethodOptions

properties

urlSchemeString

⚠️ 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.

applePayOptionsPrimerApplePayOptions

⚠️ Required when using Apple Pay in your integration.

properties

merchantIdentifierStringRequired

Set it to the merchant identifier as it is shown in your Apple Pay certificate.

merchantNameStringRequired

Set it the merchant name that you want to be shown on the Apple Pay screen.

isCaptureBillingAddressEnabledBool

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

klarnaOptionsPrimerKlarnaOptions

⚠️ Required when using Klarna in your integration.

properties

recurringPaymentDescriptionStringRequired

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

threeDsOptionsPrimerThreeDsOptions

properties

threeDsAppRequestorUrlString

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.

uiOptionsPrimerUIOptions

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

properties

isInitScreenEnabledBool

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

isSuccessScreenEnabledBool

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

isErrorScreenEnabledBool

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

themePrimerTheme

Set a custom theme for Primer SDK.

debugOptionsPrimerDebugOptions

properties

is3DSSanityCheckEnabledBoolRequired

delegatePrimerHeadlessUniversalCheckoutDelegateOptional

Set the delegate to receive updates of the checkout lifecycle.

uiDelegatePrimerHeadlessUniversalCheckoutUIDelegateOptional

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