Android SDK
- Installation
- Primer
- PrimerHeadlessUniversalCheckout
- Logging
- Common objects
configure
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.
fun configure(
settings: PrimerSettings? = null,
listener: PrimerCheckoutListener? = null,
)
Parameters
Hide Properties
Hide Properties
⚠️ If no settings are provided, the SDK will initialize with its default settings.
Use PrimerSettings
to provide different options based on your use case.
Hide child attributes
Hide child attributes
Force the payment handling in the SDK.
Show child attributes
Show child attributes
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.
Force the SDK locale. By default, the locale will be set to the device’s locale.
Show child attributes
Show child attributes
Sets the deeplink schema used when redirecting back from 3rd party applications to your application.
⚠️ Required when using Google Pay in your integration.
Hide Properties
Hide Properties
Set it the merchant name that you want to be shown on the Google Pay screen.
Sets the card networks that your application accepts.
Sets whether user’s billing address should be captured from Google Pay.
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.
Indicates whether the shipping address should be collected during the checkout process. Note that setting at least one shipping method in Checkout. Shipping module is necessary
Hide PrimerGoogleShippingAddressParameters
Hide PrimerGoogleShippingAddressParameters
Sets whether the phone number should also be collected.
Indicates whether selecting a shipping method is required during the checkout process. At least one shipping option should be configured in order to use this option.
This should be set to true
if the shippingAddressParameters
are also used.
Indicates whether the email address should be collected during the checkout process.
A configuration class for customizing the appearance of the Google Pay button.
Hide Properties
Hide Properties
Google Pay Button type as described in the official documentation.
Google Pay button style as described in the official documentation
⚠️ Required when using Stripe ACH in your integration.
Hide Properties
Hide Properties
Set the Stripe publishable key.
Data used for mandate in Drop-in
Show child attributes
Show child attributes
Data for the mandate allowing you to specify the name of the merchant that would be used in a predefined mandate template.
Hide Properties
Hide Properties
The name of the merchant.
Data for the mandate allowing you to specify the string resource pointing to the full mandate.
Hide Properties
Hide Properties
The string resource pointing to the full mandate.
Sets the different UI options in the SDK.
Hide Properties
Hide Properties
Set to false
to hide the loading screen before the Universal Checkout or the Vault Manager.
Set to false
to hide the screen after a successful payment, or tokenization on the vault flow.
Set to false
to hide the error screen when an error occurs.
Set the mechanism for dismissing Universal Checkout. Options are:
GESTURES
: The dialog can be dismissed by tapping outside or by swiping down.CLOSE_BUTTON
: A close button is provided, allowing users to dismiss the dialog manually.
Set a custom theme for Primer SDK.
Sets the different debug options in the SDK.
Hide Properties
Hide Properties
Sets whether the security warnings returned when performing 3DS are ignored.
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.
Indicates the API version to use when interacting with the Primer backend. Options are:
PrimerApiVersion.V2_3
- will use ApiVersion 2.3PrimerApiVersion.V2_4
- will use ApiVersion 2.4PrimerApiVersion.LATEST
- will use the latest available ApiVersion version
Note that this is optional, if a value is not supplied, ApiVersion V2.4
will be used by default.
Set Primer SDK’s Checkout Listener and implement the required methods.
Example
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)