@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>;
        initiatePayerAction(
            options: InitiatePayerActionOptions,
        ): Promise<InitiatePayerActionResponse>;
    }
    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,
      });
    • Launches the 3DS (Strong Customer Authentication) flow for an order.

      Parameters

      Returns Promise<InitiatePayerActionResponse>

      Promise resolving with the 3DS liabilityShift outcome on success, and rejecting on cancel or failure

      Call this after confirmOrder returns a status of "PAYER_ACTION_REQUIRED". It opens PayPal's 3DS iframe modal and resolves once the buyer completes authentication, with the resulting liabilityShift.

      If the buyer cancels the modal or authentication fails, the promise rejects so the merchant does not capture an unauthenticated order.

      Note for Google Pay: the 3DS modal can only open after Google's payment sheet has closed, and that sheet stays open until the onPaymentAuthorized callback resolves. Do not await this method inside onPaymentAuthorized — return { transactionState: "SUCCESS" } to close the sheet first, then handle this promise out-of-band.