> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.

```kotlin KOTLIN theme={"dark"}
fun configure(
    settings: PrimerSettings? = null,
    listener: PrimerCheckoutListener? = null,
)
```

## Parameters

**Properties**

**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** `PrimerPaymentHandling`

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](https://primer.io/docs/checkout/advanced/manual-payment-creation.md)
by yourself.

**locale** `Locale`

Force the SDK locale. By default, the locale will be set to the device's
locale.

**paymentMethodOptions** `PrimerPaymentMethodOptions`

**redirectScheme** `String?`

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**

**threeDsAppRequestorUrl** `String?`

Set the [App link](https://developer.android.com/training/app-links) 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**

**merchantName** `String?`

Set it the merchant name that you want to be shown on the Google Pay screen.

**allowedCardNetworks** `List\<String\>` *deprecated*

**Deprecated** — setting this no longer has any effect. Configure supported card networks with [`orderedAllowedCardNetworks`](https://primer.io/docs/api-reference/v2.4/api-reference/client-session-api/create-a-client-session#request.body.paymentMethod.orderedAllowedCardNetworks) in your client session.

**allowCreditCards** `Boolean`

Sets whether credit cards are allowed as a payment method through Google Pay. Set it to `false` to prevent credit cards from being offered.

**allowPrepaidCards** `Boolean`

Sets whether prepaid cards are allowed as a payment method through Google Pay. Set it to `false` to prevent prepaid cards from being offered.

> [!NOTE]
>
> Google Pay has no equivalent flag to disallow debit cards, so a credit-only configuration is not achievable on the platform.

**buttonStyle** `GooglePayButtonStyle`

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.

**captureBillingAddress** `Boolean`

Sets whether user's billing address should be captured from Google Pay.

**existingPaymentMethodRequired** `Boolean`

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.

**shippingAddressParameters** `PrimerGoogleShippingAddressParameters`

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

**PrimerGoogleShippingAddressParameters**

**phoneNumberRequired** `Boolean`

Sets whether the phone number should also be collected.

**requireShippingMethod** `Boolean`

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.

**emailAddressRequired** `Boolean`

Indicates whether the email address should be collected during the checkout
process.

**buttonOptions** `GooglePayButtonOptions`

A configuration class for customizing the appearance of the Google Pay button.

**Properties**

**buttonType** `Int`

Google Pay Button type as described in the official [documentation](https://developers.google.com/pay/api-reference/android/guides/brand-guidelines).

**buttonTheme** `Int`

Google Pay button style as described in the official [documentation](https://developers.google.com/pay/api-reference/android/guides/brand-guidelines#personalization)

**klarnaOptions** `PrimerKlarnaOptions`

⚠️ Required when using Klarna in your integration.

**Properties**

**recurringPaymentDescription** `String?`

Set the payment description that will be shown on the Klarna screen.

**webViewTitle** `String?`

⚠️ 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**

**publishableKey** `String?`

Set the [Stripe publishable key](https://docs.stripe.com/keys#obtain-api-keys).

**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**

**merchantName** `String`

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** `Boolean`

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

**isSuccessScreenEnabled** `Boolean`

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

**isErrorScreenEnabled** `Boolean`

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

**dismissalMechanism** `DismissalMechanism`

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.

**theme** `PrimerTheme`

Set a custom theme for Primer SDK.

**cardFormUIOptions** `PrimerCardFormUIOptions?`

Configure the card form UI options.

**Properties**

**payButtonAddNewCard** `Boolean`

When set to true, the Drop-In's card form pay button will show "Add new card"; otherwise
it will show "Pay \$x.xx".

**debugOptions** `PrimerDebugOptions`

Sets the different debug options in the SDK.

**Properties**

**is3DSSanityCheckEnabled** `Boolean`

Sets whether the security warnings returned when performing 3DS are ignored.

**clientSessionCachingEnabled** `Boolean`

> [!WARNING]
>
> 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.

**apiVersion** `PrimerApiVersion`

Indicates the API version to use when interacting with the Primer backend. Options are:

* `PrimerApiVersion.V2_4` - will use ApiVersion 2.4
* `PrimerApiVersion.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.

**listener** `PrimerCheckoutListener`

Set Primer SDK's [Checkout Listener](https://primer.io/docs/sdk/android/v2.x.x/primer/listeners/PrimerCheckoutListener.md) and implement the required methods.

## Example

```kotlin KOTLIN theme={"dark"}
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,
  ),
  cardFormUIOptions = PrimerCardFormUIOptions(
    payButtonAddNewCard = true,
  ),
  debugOptions = PrimerDebugOptions(is3DSSanityCheckEnabled = false),
  threeDsOptions = PrimerThreeDsOptions("APP_LINK")
)

Primer.instance.configure(settings, listener)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.