Configure Universal Checkout using this method. Based on the use case, set different settings that can be passed to Universal Checkout. Set the Primer Checkout listener in order to receive different events from the SDK. Please refer to the section below for more information.
1234
fun configure( settings: PrimerSettings? = null, listener: PrimerCheckoutListener? = null,)
Parameters
settingsPrimerSettings
⚠️ If no settings are provided, the SDK will initialize with its default settings.
Use PrimerSettings
to provide different options based on your use case.
paymentHandlingPrimerPaymentHandlingDefault: PrimerPaymentHandling.AUTO
Force the payment handling in the SDK.
AUTO
By default, the SDK operates in PrimerPaymentHandling.AUTO
mode. In this case the SDK is responsible for creating the payment.
MANUAL
You can use the PrimerPaymentHandling.MANUAL
option
in order to handle the payment creation
by yourself.
localeLocale
Force the SDK locale. By default, the locale will be set to the device's locale.paymentMethodOptionsPrimerPaymentMethodOptions
redirectSchemeString?
Sets the deeplink schema used when redirecting back from 3rd party applications to your application.threeDsOptionsPrimerThreeDsOptions
Sets the 3DS options in the SDK.Properties
threeDsAppRequestorUrlString?
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.
googlePayOptionsPrimerGooglePayOptions
⚠️ Required when using Google Pay in your integration.Properties
merchantNameString?
Set it the merchant name that you want to be shown on the Google Pay screen.allowedCardNetworksList<String>Default: listOf("AMEX", "DISCOVER", "JCB", "MASTERCARD","VISA")
Sets the card networks that your application accepts.
buttonStyleGooglePayButtonStyleDefault: GooglePayButtonStyle.BLACK
Sets the style of the Google Pay button.GooglePayButtonStyle
BLACK
Style of button to be used on light theme.WHITE
Style of button to be used on dark theme.captureBillingAddressBooleanDefault: false
Sets whether user's billing address should be captured from Google Pay.klarnaOptionsPrimerKlarnaOptions
⚠️ Required when using Klarna in your integration.Properties
recurringPaymentDescriptionString?
Set the payment description that will be shown on the Klarna screen.webViewTitleString?Default: Klarna
⚠️ This option is Deprecated
.
Sets the toolbar title of the Activity displaying Klarna views.
apayaOptionsPrimerApayaOptions
⚠️ Required when using Apaya in your integration.Properties
webViewTitleString?Default: Apaya
⚠️ This option is Deprecated
.
Sets the toolbar title of the Activity displaying Klarna views.
uiOptionsPrimerUIOptions
Sets the different UI options in the SDK.Properties
isInitScreenEnabledBooleanDefault: true
Set to false
to hide the loading screen before the Universal Checkout or the Vault Manager.
isSuccessScreenEnabledBooleanDefault: true
Set to false
to hide the screen after a successful payment, or tokenization on the vault flow.
isErrorScreenEnabledBooleanDefault: true
Set to false
to hide the error screen when an error occurs.
themePrimerTheme
Set a custom theme for Primer SDK.
debugOptionsPrimerDebugOptions
Sets the different debug options in the SDK.Properties
is3DSSanityCheckEnabledBooleanDefault: false
Sets whether the security warnings returned when performing 3DS are ignored.listenerPrimerCheckoutListener
Set Primer SDK's Checkout Listener and implement the required methods.
Example
1234567891011121314151617181920212223
val listener = object : PrimerCheckoutListener { override fun onCheckoutCompleted(checkoutData: PrimerCheckoutData) { }} val settings = PrimerSettings( paymentHandling = PrimerPaymentHandling.AUTO, paymentMethodOptions = PrimerPaymentMethodOptions( redirectScheme = "deeplink_scheme", klarnaOptions = PrimerKlarnaOptions("RECURRING_PAYMENT_DESCRIPTION"), googlePayOptions = PrimerGooglePayOptions(captureBillingAddress = true), ), uiOptions = PrimerUIOptions( isInitScreenEnabled = true, isSuccessScreenEnabled = true, isErrorScreenEnabled = true, ), debugOptions = PrimerDebugOptions(is3DSSanityCheckEnabled = false), threeDsOptions = PrimerThreeDsOptions("APP_LINK")) Primer.instance.configure(settings, listener)