Create a session and start Headless Universal Checkout with its clientToken and your custom settings.

1234567
fun start(    context: Context,    clientToken: String,    settings: PrimerSettings? = null,    checkoutListener: PrimerHeadlessUniversalCheckoutListener? = null,    uiListener: PrimerHeadlessUniversalCheckoutUiListener? = null)
kotlin
copy

Parameters

context
ContextRequired

Android Context of your Activity or Fragment.

clientToken
StringRequired

A client token as returned by the create client session call.

settings
PrimerSettings

⚠️ If no settings are provided, the SDK will initialize with its default settings.
Use PrimerSettings to provide different options based on your use case.

paymentHandling
PrimerPaymentHandlingDefault: PrimerPaymentHandling.AUTO

Force the payment handling in the SDK.

By default, the SDK operates in PrimerPaymentHandling.AUTO mode. In this case the SDK is responsible for creating the payment.

You can use the PrimerPaymentHandling.MANUAL option in order to handle the payment creation by yourself.

locale
Locale
Force the SDK locale. By default, the locale will be set to the device's locale.
paymentMethodOptions
PrimerPaymentMethodOptions
Sets the deeplink schema used when redirecting back from 3rd party applications to your application.
threeDsOptions
PrimerThreeDsOptions
Sets the 3DS options in the SDK.
Properties

Set the App 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.

googlePayOptions
PrimerGooglePayOptions
⚠️ Required when using Google Pay in your integration.
Properties
Set it the merchant name that you want to be shown on the Google Pay screen.
allowedCardNetworks
List<String>Default: listOf("AMEX", "DISCOVER", "JCB", "MASTERCARD","VISA")

Sets the card networks that your application accepts.

buttonStyle
GooglePayButtonStyleDefault: GooglePayButtonStyle.BLACK
Sets the style of the Google Pay button.
GooglePayButtonStyle
Style of button to be used on light theme.
Style of button to be used on dark theme.
captureBillingAddress
BooleanDefault: false
Sets whether user's billing address should be captured from Google Pay.
existingPaymentMethodRequired
BooleanDefault: false

If set to true, this specifies that Google Pay can only be used for payments if the user's Google Pay wallet already contains allowed payment methods.

klarnaOptions
PrimerKlarnaOptions
⚠️ Required when using Klarna in your integration.
Properties
Set the payment description that will be shown on the Klarna screen.
webViewTitle
String?Default: Klarna

⚠️ This option is Deprecated. Sets the toolbar title of the Activity displaying Klarna views.

apayaOptions
PrimerApayaOptions
⚠️ Required when using Apaya in your integration.
Properties
webViewTitle
String?Default: Apaya

⚠️ This option is Deprecated. Sets the toolbar title of the Activity displaying Klarna views.

stripeOptions
PrimerStripeOptions
⚠️ Required when using Stripe ACH in your integration.
Properties
mandateData
MandateData?
Data used for mandate in Drop-in
TemplateMandateData
Data for the mandate allowing you to specify the name of the merchant that would be used in a predefined mandate template.
Properties
The name of the merchant.
FullMandateData
Data for the mandate allowing you to specify the string resource pointing to the full mandate.
Properties
value
@StringRes Int
The string resource pointing to the full mandate.
FullMandateStringData
Data for the mandate allowing you to specify the full mandate as a string.
Properties
value
String
The full mandate.
uiOptions
PrimerUIOptions
Sets the different UI options in the SDK.
Properties
isInitScreenEnabled
BooleanDefault: true

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

isSuccessScreenEnabled
BooleanDefault: true

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

isErrorScreenEnabled
BooleanDefault: true

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

theme
PrimerTheme

Set a custom theme for Primer SDK.

debugOptions
PrimerDebugOptions
Sets the different debug options in the SDK.
Properties
is3DSSanityCheckEnabled
BooleanDefault: false
Sets whether the security warnings returned when performing 3DS are ignored.
clientSessionCachingEnabled
BooleanDefault: 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.

checkoutListener
PrimerHeadlessUniversalCheckoutListener

Set Primer SDK's Headless Checkout Listener and implement the required methods.

uiListener
PrimerHeadlessUniversalCheckoutUiListener

Set Primer SDK's Headless Checkout Ui Listener.