@paypal/paypal-js
    Preparing search index...

    Type Alias BaseCardFieldsSession

    type BaseCardFieldsSession = {
        createCardFieldsComponent: (
            config: CardFieldOptions,
        ) => CardFieldComponent;
        destroy: () => void;
        on: (
            eventName: MerchantMessagingEvents,
            callback: CardFieldsEventsOptions[MerchantMessagingEvents],
        ) => Promise<void>;
        update: (options: UpdateOptions) => void;
    }
    Index

    Properties

    createCardFieldsComponent: (config: CardFieldOptions) => CardFieldComponent

    Use this method to create and configure individual Card Field components.

    Type Declaration

      • (config: CardFieldOptions): CardFieldComponent
      • Parameters

        • config: CardFieldOptions

          Configuration options for creating individual Card Field components and customizing different base aspects such as type, placeholder, styling, and accessibility attributes.

        Returns CardFieldComponent

        An instance of the created Card Field component that can be appended to the DOM

    const numberField = cardFieldsInstance.createCardFieldsComponent({
    type: "number",
    placeholder: "Enter a number",
    });
    document
    .querySelector("#paypal-card-fields-number-container")
    .appendChild(numberField);
    destroy: () => void

    Use this method to destroy the Card Fields session instance and clean up any associated resources. After calling this method, the Card Fields session instance will no longer be usable.

    cardFieldsInstance.destroy();
    
    on: (
        eventName: MerchantMessagingEvents,
        callback: CardFieldsEventsOptions[MerchantMessagingEvents],
    ) => Promise<void>

    Use this method to register event listeners and set callbacks for them.

    Type Declaration

    cardFieldsInstance.on("focus", (eventPayload) => {
    console.log("Focus event triggered: ", eventPayload);
    });
    update: (options: UpdateOptions) => void

    Use this method to update the Card Fields session with new options.

    Type Declaration

      • (options: UpdateOptions): void
      • Parameters

        • options: UpdateOptions

          Configuration object to update the Card Fields session with new options.

        Returns void

    cardFieldsInstance.update({
    amount: {
    currencyCode: "EUR",
    value: "100.00",
    },
    isCobrandedEligible: true,
    });