Primer's SDK will need to be configured with a PrimerSettings object, no matter whether you're using the drop-in or headless integration, auto or manual flow. This object greatly depends on your payment methods configuration.

Parameters

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

Example

Create a settings object.

1234567891011121314151617181920212223242526272829
// 👇 Add thisimport PrimerSDK class MyViewController: UIViewController {     override func viewDidLoad() {        super.viewDidLoad()         // 👇 Create your settings        let settings = PrimerSettings(            paymentHandling: .auto,            localeData: PrimerLocaleData(                languageCode: "en",                regionCode: "US"),            paymentMethodOptions: PrimerPaymentMethodOptions(                urlScheme: "URL_SCHEME://",                applePayOptions: PrimerApplePayOptions(                    merchantIdentifier: "MERCHANT_IDENTIFIER",                    merchantName: "MERCHANT_NAME",                    isCaptureBillingAddressEnabled: true),                klarnaOptions: PrimerKlarnaOptions(                    recurringPaymentDescription: "RECURRING_PAYMENT_DESCRIPTION")),            uiOptions: PrimerUIOptions(                isInitScreenEnabled: false,                isSuccessScreenEnabled: false,                isErrorScreenEnabled: false),            debugOptions: PrimerDebugOptions(is3DSSanityCheckEnabled: false))    }}
swift
copy