Skip to main content
Primer Checkout Android SDK is currently in beta (v3.0.0-beta.2). The API is subject to change before the stable release.
Configuration class for SDK behavior. Pass to rememberPrimerCheckoutController().

Definition

data class PrimerSettings(
    var paymentHandling: PrimerPaymentHandling = PrimerPaymentHandling.AUTO,
    var locale: Locale = Locale.getDefault(),
    var paymentMethodOptions: PrimerPaymentMethodOptions = PrimerPaymentMethodOptions(),
    var uiOptions: PrimerUIOptions = PrimerUIOptions(),
    var debugOptions: PrimerDebugOptions = PrimerDebugOptions(),
    var clientSessionCachingEnabled: Boolean = false,
    var apiVersion: PrimerApiVersion = PrimerApiVersion.V2_4,
)
PropertyTypeDefaultDescription
paymentHandlingPrimerPaymentHandlingAUTOControls whether the SDK processes payments automatically or delegates to your server
localeLocaleLocale.getDefault()Forces the SDK locale for translations and formatting
paymentMethodOptionsPrimerPaymentMethodOptionsPrimerPaymentMethodOptions()Payment method-specific configuration (Google Pay, Klarna, 3DS, Stripe)
uiOptionsPrimerUIOptionsPrimerUIOptions()UI behavior settings (screens, dismissal, theming)
debugOptionsPrimerDebugOptionsPrimerDebugOptions()Debug and development options
clientSessionCachingEnabledBooleanfalseCaches the client session to reduce network requests
apiVersionPrimerApiVersionV2_4Primer API version used for backend communication

Usage

val settings = PrimerSettings(
    locale = Locale.GERMANY,
    uiOptions = PrimerUIOptions(
        isInitScreenEnabled = false,
        dismissalMechanism = listOf(DismissalMechanism.CLOSE_BUTTON),
    ),
    paymentMethodOptions = PrimerPaymentMethodOptions(
        redirectScheme = "myapp://primer",
        googlePayOptions = PrimerGooglePayOptions(
            merchantName = "My Store",
            captureBillingAddress = true,
        ),
    ),
)

val checkout = rememberPrimerCheckoutController(
    clientToken = clientToken,
    settings = settings,
)

PrimerUIOptions

Controls checkout UI behavior: which screens are shown, how the sheet is dismissed, and theming.
data class PrimerUIOptions(
    var isInitScreenEnabled: Boolean = true,
    var isSuccessScreenEnabled: Boolean = true,
    var isErrorScreenEnabled: Boolean = true,
    var dismissalMechanism: List<DismissalMechanism> = listOf(DismissalMechanism.GESTURES),
    var theme: PrimerTheme = PrimerTheme(),
    var cardFormUIOptions: PrimerCardFormUIOptions = PrimerCardFormUIOptions(),
)
PropertyTypeDefaultDescription
isInitScreenEnabledBooleantrueShows a loading screen while the checkout initializes
isSuccessScreenEnabledBooleantrueShows a success screen after payment completes
isErrorScreenEnabledBooleantrueShows an error screen when a payment fails
dismissalMechanismList<DismissalMechanism>[GESTURES]How the user can dismiss the checkout sheet
themePrimerThemePrimerTheme.build()Visual theme for all SDK components
cardFormUIOptionsPrimerCardFormUIOptionsPrimerCardFormUIOptions()Card form-specific UI options

DismissalMechanism

ValueDescription
GESTURESDismiss by tapping outside or swiping down
CLOSE_BUTTONShows a close button in the sheet header

PrimerCardFormUIOptions

PropertyTypeDefaultDescription
payButtonAddNewCardBooleanfalseWhen true, the card form button shows “Add new card” instead of “Pay $X.XX”

PrimerPaymentMethodOptions

Payment method-specific configuration. Set redirectScheme for any flow that redirects to a third-party app (3DS, PayPal, Klarna).
data class PrimerPaymentMethodOptions(
    var redirectScheme: String? = null,
    var googlePayOptions: PrimerGooglePayOptions = PrimerGooglePayOptions(),
    var klarnaOptions: PrimerKlarnaOptions = PrimerKlarnaOptions(),
    var threeDsOptions: PrimerThreeDsOptions = PrimerThreeDsOptions(),
    var stripeOptions: PrimerStripeOptions = PrimerStripeOptions(),
)
PropertyTypeDefaultDescription
redirectSchemeString?nullDeep link scheme for returning from third-party apps (e.g., "myapp://primer")
googlePayOptionsPrimerGooglePayOptionsPrimerGooglePayOptions()Google Pay configuration. Required when using Google Pay.
klarnaOptionsPrimerKlarnaOptionsPrimerKlarnaOptions()Klarna configuration. Required when using Klarna.
threeDsOptionsPrimerThreeDsOptionsPrimerThreeDsOptions()3D Secure configuration
stripeOptionsPrimerStripeOptionsPrimerStripeOptions()Stripe ACH configuration. Required when using Stripe ACH.

PrimerGooglePayOptions

PropertyTypeDefaultDescription
merchantNameString?nullMerchant name displayed in the Google Pay sheet
buttonStyleGooglePayButtonStyleButton appearance: WHITE or BLACK
captureBillingAddressBooleanfalseRequests billing address from Google Pay
existingPaymentMethodRequiredBooleanfalseOnly shows Google Pay if the user has a saved payment method
shippingAddressParametersPrimerGoogleShippingAddressParameters?nullShipping address requirements (has phoneNumberRequired)
requireShippingMethodBooleanfalseRequires a shipping method selection
emailAddressRequiredBooleanfalseRequests email from Google Pay
buttonOptionsGooglePayButtonOptionsButton customization (buttonTheme, buttonType)

PrimerKlarnaOptions

PropertyTypeDefaultDescription
recurringPaymentDescriptionString?nullDescription shown for recurring Klarna payments
returnIntentUrlString?nullReturn URL after Klarna authorization

PrimerThreeDsOptions

PropertyTypeDefaultDescription
threeDsAppRequestorUrlString?nullApp requestor URL for 3DS2 authentication

PrimerStripeOptions

PropertyTypeDefaultDescription
mandateDataMandateData?nullACH mandate text. Use TemplateMandateData(merchantName) for a standard template, or FullMandateStringData(value) / FullMandateData(@StringRes value) for custom text.
publishableKeyString?nullStripe publishable key

PrimerDebugOptions

PropertyTypeDefaultDescription
is3DSSanityCheckEnabledBooleantrueEnables 3DS security sanity checks. Disable only during development.

PrimerPaymentHandling

ValueDescription
AUTOSDK processes payment end-to-end. Emits Success or Failure events.

PrimerApiVersion

ValueDescription
V2_4Primer API version 2.4 (latest)