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

    Interface GooglePayOneTimePaymentSession

    Google Pay one-time payment session

    This session object manages the Google Pay payment flow. Unlike other payment methods, Google Pay does not use a start() callback pattern. Instead, merchants control the flow via Google's PaymentsClient and call confirmOrder() when payment data is received.

    interface GooglePayOneTimePaymentSession {
        confirmOrder(
            options: GooglePayConfirmOrderOptions,
        ): Promise<GooglePayApprovePaymentResponse>;
        formatConfigForPaymentRequest(
            googlePayConfigFromFindEligibleMethods: GooglePayConfigFromFindEligibleMethods,
        ): GooglePayConfig;
        getGooglePayConfig(): Promise<GooglePayConfigResponse>;
    }
    Index

    Methods

    • Transforms Google Pay eligibility config into the format required by Google's PaymentsClient

      Parameters

      Returns GooglePayConfig

      Formatted configuration ready for Google Pay SDK

      Performs field renames required by Google's API:

      • supportedNetworks becomes allowedCardNetworks
      • merchantCountry becomes countryCode
      • Removes authJwt in sandbox environments

      This must be called before passing config to isReadyToPay() or loadPaymentData().

      const details = paymentMethods.getDetails("googlepay");
      const googlePayConfig = session.formatConfigForPaymentRequest(details.config);
      const isReady = await paymentsClient.isReadyToPay({
      allowedPaymentMethods: googlePayConfig.allowedPaymentMethods,
      apiVersion: googlePayConfig.apiVersion,
      apiVersionMinor: googlePayConfig.apiVersionMinor,
      });