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

    Result object returned by findEligibleMethods() containing methods to check payment method eligibility and retrieve payment method details.

    This interface is returned by the SDK's findEligibleMethods() method. It provides utilities to determine which PayPal payment methods are available and to retrieve details for payment setup.

    const paymentMethods = await sdkInstance.findEligibleMethods({
    currencyCode: "USD",
    });

    if (paymentMethods.isEligible("paypal")) {
    const paypalPaymentSession = sdkInstance.createPayPalOneTimePaymentSession({
    onApprove: (data) => console.log('Payment approved:', data),
    });
    // set up button
    // ...
    }

    if (paymentMethods.isEligible("paylater")) {
    const paylaterPaymentMethodDetails = paymentMethods.getDetails("paylater");
    const { productCode, countryCode } = paylaterPaymentMethodDetails;

    const paylaterPaymentSession = sdkInstance.createPayLaterOneTimePaymentSession({
    onApprove: (data) => console.log('Pay Later approved:', data),
    });

    // set up button
    const paylaterButton = document.querySelector("#paylater-button");
    paylaterButton.productCode = productCode;
    paylaterButton.countryCode = countryCode;
    // ...
    }

    if (paymentMethods.isEligible("credit")) {
    const paypalCreditPaymentMethodDetails = paymentMethods.getDetails("credit");
    const { countryCode } = paypalCreditPaymentMethodDetails;

    const paypalCreditPaymentSession = sdkInstance.createPayPalCreditOneTimePaymentSession({
    onApprove: (data) => console.log('Credit approved:', data),
    });

    // set up button
    const paypalCreditButton = document.querySelector("#paypal-credit-button");
    paypalCreditButton.countryCode = countryCode;
    // ...
    }
    interface EligiblePaymentMethodsOutput {
        getDetails: <T extends FundingSource>(
            fundingSource: T,
        ) => FindEligibleMethodsGetDetails<T>;
        isEligible: (paymentMethod: FundingSource) => boolean;
    }
    Index

    Properties

    getDetails: <T extends FundingSource>(
        fundingSource: T,
    ) => FindEligibleMethodsGetDetails<T>

    Retrieves details for a specific funding source.

    Type Declaration

    isEligible: (paymentMethod: FundingSource) => boolean

    Determines if a specific payment method is eligible.

    Type Declaration

      • (paymentMethod: FundingSource): boolean
      • Parameters

        • paymentMethod: FundingSource

          The funding source to check eligibility for

        Returns boolean

        true if the payment method is eligible, false otherwise