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

This method is deprecated. Set the options on the [`createHeadless` method](/sdk/web/v2.x.x/primer/methods/createHeadless) instead.

```ts TS theme={"dark"}
configure(options: HeadlessUniversalCheckoutOptions): void
```

Configure the Headless Checkout instance with the provided options.

## Parameters

<Expandable title="Parameters" defaultOpen>
  <ResponseField name="options" type="object">
    Options for a Headless Universal Checkout, its properties can be defined to
    configure the checkout experience.

    <Expandable defaultOpen title="Properties">
      <ResponseField name="onAvailablePaymentMethodsLoad" type="(paymentMethods: PaymentMethodInfo[]) => void" required>
        Called when the available payment methods have been loaded. Takes an array
        of objects as its argument.

        <Expandable defaultOpen title="Parameters">
          <ResponseField name="paymentMethods" type="PaymentMethodInfo[]">
            <Expandable defaultOpen title="Properties">
              <ResponseField name="type" type="PaymentMethodType" required>
                The type of payment method, one of [PaymentMethodType](/sdk/web/v2.x.x/constants/payment-method-types).
              </ResponseField>

              <ResponseField name="managerType" type="&#x22;CARD&#x22; | &#x22;NATIVE&#x22; | &#x22;REDIRECT&#x22;" required>
                The type of payment manager to use.
              </ResponseField>
            </Expandable>
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="locale" type="string">
        This option sets the locale for UI elements and redirect payment method URLs. By default, if locale is not set, all UI elements will be in English. However, redirect URLs for certain redirect payment methods will be determined based on the user's locale. If you set this locale option, all UI elements as well as the URLs of redirect payment methods will use the locale specified in this option.
      </ResponseField>

      <ResponseField name="merchantDomain" type="string">
        Optional domain override. **Required for Apple Pay when the checkout is rendered in a cross-origin iframe.**

        For example, if your main page is `example.com` and the iframe checkout is hosted at `iframecheckout.com`,
        you must set this to `example.com` to ensure Apple Pay functions properly.

        **Additional Requirements:**

        * The iframe element must include `allow="payment"` attribute
        * Only supported on Safari 17 or later
      </ResponseField>

      <ResponseField name="apiVersion" type="&#x22;legacy&#x22; | &#x22;2.4&#x22;" post={['Default: "2.4"']}>
        Specifies the API version to use when interacting with the Primer backend.

        * If not explicitly set, defaults to version `'2.4'`.
        * Set this to `'legacy'` if you encounter compatibility issues with the latest API version and wish to revert to the previous stable behavior.
      </ResponseField>
    </Expandable>

    <Expandable defaultOpen title="Payment lifecycle callbacks">
      <ResponseField name="onPaymentCreationStart" type="() => void">
        Notifies you before the checkout tokenizes a payment method and creates a
        payment.
      </ResponseField>

      <ResponseField name="onBeforePaymentCreate" type="(data: object, handler: object) => void">
        Called when a payment will be created.
        Use as an opportunity to update UI accordingly - for example, to display a "loading" component.
        The `handler` must be used to then abort or continue with payment creation.
        Primer will continue with payment creation if `onBeforePaymentCreate` is not implemented.

        <Expandable defaultOpen title="Parameters">
          <ResponseField name="data" type="object">
            <Expandable defaultOpen title="Properties">
              <ResponseField name="paymentMethodType" type="string">
                The type of the payment method Primer will use for payment creation, one of [PaymentMethodType](/sdk/web/v2.x.x/constants/payment-method-types)
              </ResponseField>
            </Expandable>
          </ResponseField>

          <ResponseField name="handler" type="object">
            Provides two methods to continue or abort the payment.

            <Warning>
              You MUST call one of the methods of the handler if `onBeforePaymentCreate` is implemented.
            </Warning>

            Choose to abort a payment.

            ```ts TS theme={"dark"}
            return handler.abortPaymentCreation();
            ```

            Choose to continue with payment creation

            ```ts TS theme={"dark"}
            return handler.continuePaymentCreation();
            ```

            You can also pass an idempotency key which will be sent with the payment request to prevent duplicate payments from being created.

            ```ts TS theme={"dark"}
            return handler.continuePaymentCreation({ idempotencyKey: 'my-unique-key' });
            ```
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="onCheckoutComplete" type="(data: object) => void">
        Called when a payment has been created.
        Move on to next step in your checkout flow, such as showing a success message, etc.

        <Expandable defaultOpen title="Parameters">
          <ResponseField name="data" type="object">
            <Expandable title="Properties" defaultOpen>
              <ResponseField name="payment" type="object">
                <Expandable title="Properties" defaultOpen>
                  <ResponseField name="id" type="string">
                    Primer's unique identifier for the payment.
                  </ResponseField>

                  <ResponseField name="orderId" type="string">
                    Your order identifier as provided in the client session.
                  </ResponseField>

                  <ResponseField name="paymentMethodData" type="object">
                    Optional payment method data - for some payment methods this object
                    will contain additional information on the payment.
                  </ResponseField>
                </Expandable>
              </ResponseField>
            </Expandable>
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="onCheckoutFail" type="(error: PrimerClientError, data: object, handler: object) => void">
        Called when the checkout flow has failed.

        <Expandable defaultOpen title="Parameters">
          <ResponseField name="error" type="PrimerClientError">
            <Expandable defaultOpen title="Properties">
              <ResponseField name="code" type="ErrorCode">
                {" "}
              </ResponseField>

              <ResponseField name="message" type="string">
                {" "}
              </ResponseField>

              <ResponseField name="diagnosticsId" type="Nullable<string>">
                {" "}
              </ResponseField>

              <ResponseField name="data" type="object">
                {" "}
              </ResponseField>

              <ResponseField name="isFromDeveloper" type="boolean">
                {" "}
              </ResponseField>

              <ResponseField name="fromErrorCode" type="(code: ErrorCode, options: ErrorOptions) => PrimerClientError">
                {" "}
              </ResponseField>
            </Expandable>
          </ResponseField>

          <ResponseField name="data" type="object">
            <Expandable defaultOpen title="Properties">
              <ResponseField name="payment" type="object">
                When checkout fails, the payment might or might not have been created.
                If it was created, the payment object contains some information
                regarding it.

                <Expandable defaultOpen title="Properties">
                  <ResponseField name="id" type="string">
                    Primer's unique identifier for the payment.
                  </ResponseField>

                  <ResponseField name="orderId" type="string">
                    Your order identifier as provided in the client session.
                  </ResponseField>

                  <ResponseField name="paymentMethodData" type="object">
                    Optional payment method data - for some payment methods this object
                    will contain additional information on the payment.
                  </ResponseField>
                </Expandable>
              </ResponseField>
            </Expandable>
          </ResponseField>

          <ResponseField name="handler" type="object">
            If `handler` is `undefined`, the SDK does not expect anything from you.

            If `handler` exists, you MUST call one of the functions of the handler.

            ```ts TS theme={"dark"}
            import { Primer } from "@primer-io/checkout-web";

            Primer.createHeadless(clientToken, {
              onCheckoutComplete(...args) {
                console.log("onCheckoutComplete", ...args);
              },
              onCheckoutFail(error, data, handler) {
                if (!handler) {
                  return;
                }

                // Tells the SDK that it can proceed
                // Note: this does not show any error message
                return handler.showErrorMessage();
              },
            });
            ```

            <Expandable defaultOpen title="Properties">
              <ResponseField name="showErrorMessage" type="() => void">
                Tells the SDK that the error has been properly handled by your application.
                This does not display any error message.
              </ResponseField>
            </Expandable>
          </ResponseField>
        </Expandable>
      </ResponseField>
    </Expandable>

    <Expandable defaultOpen title="Event callbacks">
      <ResponseField name="onPaymentMethodAction" type="(action: string, data: object) => void">
        Notifies you when a specific payment method has been selected or unselected.

        <Expandable defaultOpen title="Parameters">
          <ResponseField name="action" type="'PAYMENT_METHOD_SELECTED' | 'PAYMENT_METHOD_UNSELECTED'">
            The action being performed on the payment method. Payment will be unselected
            when a popup is closed.
          </ResponseField>

          <ResponseField name="data" type="object">
            <Expandable defaultOpen title="Properties">
              <ResponseField name="paymentMethodType" type="string">
                The type of the payment method Primer will use for payment creation, one of
                [PaymentMethodType](/sdk/web/v2.x.x/constants/payment-method-types)
              </ResponseField>

              <ResponseField name="payment" type="object | undefined">
                The payment object, available when a payment has already been created before the payment method is unselected.

                <Expandable title="Properties">
                  <ResponseField name="id" type="string">
                    The unique identifier of the payment.
                  </ResponseField>
                </Expandable>
              </ResponseField>
            </Expandable>
          </ResponseField>
        </Expandable>
      </ResponseField>
    </Expandable>

    <Expandable defaultOpen title="Payment methods options">
      <ResponseField name="redirect" type="object">
        Options for payment methods that rely on redirecting.

        <Expandable defaultOpen title="Properties">
          <ResponseField name="returnUrl" type="string">
            The URL to return to after the redirect process has completed.
          </ResponseField>

          <ResponseField name="forceRedirect" type="boolean">
            Whether to always use a redirect flow, rather than a popup window, even if
            other options are available. Default value is `false`.
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="googlePay" type="object">
        Options for using Google Pay as a payment method.

        <Expandable defaultOpen title="Properties">
          <ResponseField name="captureBillingAddress" type="boolean">
            Whether to prompt the user to select a billing address.
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="applePay" type="object">
        Options for using Apple Pay as a payment method.

        <Expandable defaultOpen title="Properties">
          <ResponseField name="captureBillingAddress" type="boolean" deprecated>
            Whether to display a prompt for the user to enter their billing address
            during the payment process.
          </ResponseField>

          <ResponseField name="billingOptions" type="object">
            Billing contact configuration options for Apple Pay.

            <Expandable defaultOpen title="Properties">
              <ResponseField name="requiredBillingContactFields" type="(&#x22;postalAddress&#x22; | &#x22;phoneNumber&#x22; | &#x22;emailAddress&#x22;)[]" required>
                An array of string values that specify which required contact
                information fields should be collected during the checkout process.
              </ResponseField>
            </Expandable>
          </ResponseField>

          <ResponseField name="shippingOptions" type="object">
            Shipping contact configuration options for Apple Pay.

            <Expandable defaultOpen title="Properties">
              <ResponseField name="requiredShippingContactFields" type="(&#x22;postalAddress&#x22; | &#x22;name&#x22; | &#x22;phoneNumber&#x22; | &#x22;emailAddress&#x22;)[]" required>
                An array of string values that specify which required contact
                information fields should be collected during the checkout process.
              </ResponseField>
            </Expandable>
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="allowedCardNetworks" type="CardNetwork[]" deprecated>
        Allowed card networks for credit card payments, one of
        [CardNetwork](/sdk/web/v2.x.x/constants/card-networks).
      </ResponseField>
    </Expandable>

    <Expandable defaultOpen title="Manual payment handling">
      <ResponseField name="paymentHandling" type="&#x22;AUTO&#x22; | &#x22;MANUAL&#x22;">
        The `paymentHandling` option defines how the SDK should handle payment creation and resume.

        The default is `AUTO`, set `paymentHandling` to `MANUAL` to turn off automatic payment handling. This disables the callbacks `onBeforePayment` and `onCheckoutComplete`.

        Two callbacks must be implemented:

        * `onTokenizeSuccess()` to create payments with the `paymentMethodToken`.
        * `onResumeSuccess()` to resume payments with `resumeToken`.

        See the [Manual Payment Creation](/checkout/advanced/manual-payment-creation) guide for examples.

        <Note>
          The guide's examples are written for `PrimerCheckout`, but the same concepts apply to `PrimerHeadlessCheckout`.
        </Note>
      </ResponseField>

      <ResponseField name="onTokenizeSuccess" type="(data: PaymentMethodTokenData, handler: OnTokenizeSuccessHandler) => void">
        <Note>
          If you set `paymentHandling` to `MANUAL`, implementing this is mandatory.
        </Note>

        <Expandable defaultOpen title="Parameters">
          <ResponseField name="data" type="PaymentMethodTokenData">
            <Expandable defaultOpen title="Properties">
              <ResponseField name="token" type="string" required>
                The payment instrument token you can use to [create a payment request](/api-reference/v2.4/api-reference/payments-api/create-a-payment) from your backend.
              </ResponseField>

              <ResponseField name="analyticsId" type="string">
                An unique identifier for the payment instrument token.
              </ResponseField>

              <ResponseField name="paymentInstrumentData" type="PaymentInstrumentData">
                Additional information about the payment instrument.
                Depending on the payment method type, only some of the following properties are present on the object.

                <Expandable defaultOpen title="Properties">
                  <ResponseField name="paymentMethodConfigId" type="string">
                    The identifier for the payment method configuration.
                  </ResponseField>

                  <ResponseField name="paymentMethodType" type="string">
                    The type of the payment method used for the transaction, one of [PaymentMethodType](/sdk/web/v2.x.x/constants/payment-method-types).
                  </ResponseField>

                  <ResponseField name="sessionInfo" type="SessionInfo">
                    Information about the session associated with the transaction.
                  </ResponseField>

                  <ResponseField name="first6Digits" type="string">
                    The first six digits of the payment card.
                  </ResponseField>

                  <ResponseField name="last4Digits" type="string">
                    The last four digits of the payment card.
                  </ResponseField>

                  <ResponseField name="expirationMonth" type="string">
                    The expiration month of the payment card.
                  </ResponseField>

                  <ResponseField name="expirationYear" type="string">
                    The expiration year of the payment card.
                  </ResponseField>

                  <ResponseField name="cardholderName" type="string">
                    The name of the cardholder as it appears on the payment card.
                  </ResponseField>

                  <ResponseField name="network" type="string">
                    The network associated with the payment card (e.g., Visa, Mastercard).
                  </ResponseField>

                  <ResponseField name="isNetworkTokenized" type="string">
                    Indicates whether the payment card's network is tokenized.
                  </ResponseField>

                  <ResponseField name="binData" type="BinData">
                    Information about the Bank Identification Number (BIN) of the payment card.
                  </ResponseField>

                  <ResponseField name="threeDSecureAuthentication" type="ThreeDSAuthenticationData">
                    Data related to 3D Secure authentication for the transaction.

                    <Expandable defaultOpen title="Properties">
                      <ResponseField name="responseCode" type="ThreeDSecureStatus">
                        Indicates the outcome of the 3D Secure authentication process.\
                        Possible values:

                        * `AUTH_SUCCESS`: The authentication was successful.
                        * `AUTH_FAILED`: The authentication process failed.
                        * `SKIPPED`: The authentication was skipped.
                        * `CHALLENGE`: A challenge was issued during the authentication process.
                      </ResponseField>

                      <ResponseField name="reasonCode" type="string">
                        An optional code indicating the reason for the outcome of the 3D Secure authentication.
                      </ResponseField>

                      <ResponseField name="reasonText" type="string">
                        An optional text description providing further details about the reason for the authentication outcome.
                      </ResponseField>

                      <ResponseField name="protocolVersion" type="string">
                        Specifies the version of the 3D Secure protocol that was used.
                      </ResponseField>

                      <ResponseField name="challengeIssued" type="boolean">
                        Indicates whether a challenge was issued as part of the authentication process.

                        * `true`: A challenge was issued.
                        * `false`: No challenge was issued.
                      </ResponseField>
                    </Expandable>
                  </ResponseField>

                  <ResponseField name="paypalBillingAgreementId" type="string">
                    The identifier for a PayPal billing agreement, if applicable.
                  </ResponseField>

                  <ResponseField name="externalPayerInfo" type="ExternalPayerInfo">
                    External information about the payer associated with the transaction.
                  </ResponseField>

                  <ResponseField name="shippingAddress" type="ShippingAddress">
                    The shipping address for the transaction, if applicable.
                  </ResponseField>

                  <ResponseField name="klarnaCustomerToken" type="string">
                    The customer token associated with Klarna payment, if applicable.
                  </ResponseField>

                  <ResponseField name="sessionData" type="SessionData">
                    Additional data related to the session.
                  </ResponseField>
                </Expandable>
              </ResponseField>

              <ResponseField name="paymentInstrumentType" type="PaymentInstrumentType">
                The type of the payment instrument.

                Example of possible values (new values could be added as we add new payment methods):

                * `APPLE_PAY`
                * `CARD_OFF_SESSION_PAYMENT`
                * `GOOGLE_PAY`
                * `KLARNA_CUSTOMER_TOKEN`
                * `OFF_SESSION_PAYMENT`
                * `PAYMENT_CARD`
                * `PAYPAL_BILLING_AGREEMENT`
                * `PAYPAL_ORDER`
              </ResponseField>

              <ResponseField name="threeDSecureAuthentication" type="ThreeDSAuthenticationData">
                Data related to 3D Secure authentication for the transaction.

                <Expandable defaultOpen title="Properties">
                  <ResponseField name="responseCode" type="ThreeDSecureStatus">
                    Indicates the outcome of the 3D Secure authentication process.\
                    Possible values:

                    * `AUTH_SUCCESS`: The authentication was successful.
                    * `AUTH_FAILED`: The authentication process failed.
                    * `SKIPPED`: The authentication was skipped.
                    * `CHALLENGE`: A challenge was issued during the authentication process.
                  </ResponseField>

                  <ResponseField name="reasonCode" type="string">
                    An optional code indicating the reason for the outcome of the 3D Secure authentication.
                  </ResponseField>

                  <ResponseField name="reasonText" type="string">
                    An optional text description providing further details about the reason for the authentication outcome.
                  </ResponseField>

                  <ResponseField name="protocolVersion" type="string">
                    Specifies the version of the 3D Secure protocol that was used.
                  </ResponseField>

                  <ResponseField name="challengeIssued" type="boolean">
                    Indicates whether a challenge was issued as part of the authentication process.

                    * `true`: A challenge was issued.
                    * `false`: No challenge was issued.
                  </ResponseField>
                </Expandable>
              </ResponseField>

              <ResponseField name="tokenType" type="&#x22;SINGLE_USE&#x22; | &#x22;MULTI_USE&#x22;">
                Whether this payment method token can be used only once or multiple times.
              </ResponseField>

              <ResponseField name="vaultData" type="VaultData">
                <Expandable defaultOpen title="Properties">
                  <ResponseField name="customerId" type="string">
                    The `customerId` associated to the payment method, if vaulted.
                  </ResponseField>
                </Expandable>
              </ResponseField>
            </Expandable>
          </ResponseField>

          <ResponseField name="handler" type="OnTokenizeSuccessHandler">
            <Expandable defaultOpen title="Properties">
              <ResponseField name="handleSuccess" type="() => void">
                Display a success screen.
              </ResponseField>

              <ResponseField name="handleFailure" type="(errorMessage: string) => void">
                Display `errorMessage` as an error or failure message.
              </ResponseField>

              <ResponseField name="continueWithNewClientToken" type="(clientToken: string) => void">
                Continue the payment flow using the given `clientToken`.
              </ResponseField>
            </Expandable>
          </ResponseField>
        </Expandable>

        Called after a customer submitted their payment data and the payment details have been tokenized.
        You'll receive a `paymentMethodToken` in `onTokenizeSuccess()`.

        * [Create a payment request](/api-reference/v2.4/api-reference/payments-api/create-a-payment) passing the `paymentMethodToken` to your backend

        * If the payment is successful, call `handler.handleSuccess()` in order to display a success screen

        * If the payment is unsuccessful, call `handler.handleFailure(errorMessage)` to display an error or failure message

        * Payments API may return a new `clientToken` for additional steps (in the `requiredActions` on the response). In this case, call `handler.continueWithNewClientToken(clientToken)` to continue with the payment flow
      </ResponseField>

      <ResponseField name="onTokenizeError" type="(error: PrimerClientError) => void">
        Called after a customer submitted their payment data and the payment details could not be tokenized.
        Use the `PrimerClientError` data to display an error message.

        <Expandable defaultOpen title="Parameters">
          <ResponseField name="error" type="PrimerError">
            <Expandable defaultOpen title="Properties">
              <ResponseField name="code" type="ErrorCode">
                {" "}
              </ResponseField>

              <ResponseField name="message" type="string">
                {" "}
              </ResponseField>

              <ResponseField name="diagnosticsId" type="Nullable<string>">
                {" "}
              </ResponseField>

              <ResponseField name="data" type="object">
                {" "}
              </ResponseField>

              <ResponseField name="isFromDeveloper" type="boolean">
                {" "}
              </ResponseField>

              <ResponseField name="fromErrorCode" type="(code: ErrorCode, options: ErrorOptions) => PrimerClientError">
                {" "}
              </ResponseField>
            </Expandable>
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="onResumeSuccess" type="(data: ResumeToken, handler: OnResumeSuccessHandler) => void">
        Called when the resume token must be sent to your server to resume the payment flow, typically after the customer has completed some authorization step outside of the Primer SDK.

        <Note>
          If you set `paymentHandling` to `MANUAL`, handling `onResumeSuccess()` is required to fully support 3DS and the majority of payment methods.
        </Note>

        <Expandable defaultOpen title="Parameters">
          <ResponseField name="data" type="ResumeToken">
            <Expandable defaultOpen title="Properties">
              <ResponseField name="resumeToken" type="string">
                The resume token you can use to [resume the payment flow](/api-reference/v2.4/api-reference/payments-api/resume-a-payment) on your backend.
              </ResponseField>

              <ResponseField name="paymentId" type="string">
                An unique identifier of the payment on Primer.
              </ResponseField>
            </Expandable>
          </ResponseField>

          <ResponseField name="handler" type="OnResumeSuccessHandler">
            <Expandable defaultOpen title="Properties">
              <ResponseField name="handleSuccess" type="() => void">
                Display a success screen.
              </ResponseField>

              <ResponseField name="handleFailure" type="(errorMessage: string) => void">
                Display `errorMessage` as an error or failure message.
              </ResponseField>

              <ResponseField name="continueWithNewClientToken" type="(clientToken: string) => void">
                Continue the payment flow using the given `clientToken`.
              </ResponseField>
            </Expandable>
          </ResponseField>
        </Expandable>

        * You will receive a `resumeToken` via the `onResumeSuccess()` callback if applicable

        * Send a [resume payment request](/api-reference/v2.4/api-reference/payments-api/resume-a-payment) with the `resumeToken`

        * If the payment is successful, call `handler.handleSuccess()` in order to display a success screen

        * If the payment is unsuccessful, call `handler.handleFailure(errorMessage)` to display an error or failure message

        * The Payments API may again return a new `clientToken` for additional steps. In this case, call `handler.continueWithNewClientToken(clientToken)` again
      </ResponseField>

      <ResponseField name="onResumeError" type="(error: PrimerClientError) => void">
        Called when the payment cannot be resumed.
        Use the `PrimerClientError` data to display an error message.

        <Expandable defaultOpen title="Parameters">
          <ResponseField name="error" type="PrimerError">
            <Expandable defaultOpen title="Properties">
              <ResponseField name="code" type="ErrorCode">
                {" "}
              </ResponseField>

              <ResponseField name="message" type="string">
                {" "}
              </ResponseField>

              <ResponseField name="diagnosticsId" type="Nullable<string>">
                {" "}
              </ResponseField>

              <ResponseField name="data" type="object">
                {" "}
              </ResponseField>

              <ResponseField name="isFromDeveloper" type="boolean">
                {" "}
              </ResponseField>

              <ResponseField name="fromErrorCode" type="(code: ErrorCode, options: ErrorOptions) => PrimerClientError">
                {" "}
              </ResponseField>
            </Expandable>
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="onTokenizeShouldStart" type="(data: { paymentMethodType: PaymentMethodType }) => boolean">
        Called to determine if the payment method tokenization should start.

        <Expandable defaultOpen title="Parameters">
          <ResponseField name="data" type="{ paymentMethodType: PaymentMethodType }">
            An object containing a `paymentMethodType` property, one of [PaymentMethodType](/sdk/web/v2.x.x/constants/payment-method-types).
          </ResponseField>
        </Expandable>

        Implement this if you need to abort the payment method tokenization according to your own logic. You should return `true` to continue or `false` to abort.
      </ResponseField>

      <ResponseField name="onTokenizeStart" type="() => void">
        Called just before the payment method tokenization starts. Implement this to perform any custom action, for example, displaying a custom loading indicator.
      </ResponseField>

      <ResponseField name="onTokenizeDidNotStart" type="(reason: &#x22;TOKENIZATION_DISABLED&#x22; | &#x22;TOKENIZATION_SHOULD_NOT_START&#x22;) => void">
        Called if the payment method tokenization did not start. Receives a `reason` as a string.

        <Expandable defaultOpen title="Parameters">
          <ResponseField name="reason" type="&#x22;TOKENIZATION_SHOULD_NOT_START&#x22; | &#x22;TOKENIZATION_DISABLED&#x22;">
            * `TOKENIZATION_SHOULD_NOT_START`: tokenization was interrupted returning `false` from `onTokenizeShouldStart`.

            * `TOKENIZATION_DISABLED`: tokenization was disabled using `setIsTokenizationEnabled` or `setPaymentCreationEnabled`.
          </ResponseField>
        </Expandable>
      </ResponseField>
    </Expandable>

    <Expandable defaultOpen title="Client session lifecycle callbacks">
      <ResponseField name="onBeforeClientSessionUpdate" type="() => void">
        Called when the client session is in the process of being updated. Use it to
        show a loading indicator on your UI.
      </ResponseField>

      <ResponseField name="onClientSessionUpdate" type="(clientSession: ClientSession) => void">
        Called when the client session has been updated by the checkout. Returns the
        updated client session which can be used to inform your UI. For example
        updating tax, shipping or discount amounts displayed to your customers.
      </ResponseField>
    </Expandable>

    <Expandable defaultOpen title="Client session caching">
      <ResponseField name="clientSessionCachingEnabled" type="boolean" post={["Default: false"]}>
        <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.
        </Warning>

        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.
      </ResponseField>
    </Expandable>
  </ResponseField>
</Expandable>
