npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-google-pay

v3.0.0

Published

React Native Turbo Module for Google Pay

Readme

react-native-google-pay

react-native version npm npm (tag)

Accept payments with Google Pay in React Native apps. The Android implementation is a Turbo Module written in Kotlin.

Requirements

  • React Native >= 0.76 with the New Architecture enabled. React Native 0.82 and newer are New Architecture only.
  • minSdkVersion from your React Native app. Google Pay requires 23 or higher; React Native 0.88 uses 24.
  • Google Play services on the device.

Google Pay is Android-only. On other platforms setEnvironment, isReadyToPay, and requestPayment throw Google Pay is available on Android only. ENVIRONMENT_TEST is 3 and ENVIRONMENT_PRODUCTION is 1 on every platform.

Installation

yarn add react-native-google-pay

Autolinking picks up the Android Turbo Module. iOS is intentionally not linked.

Add the Google Pay API meta-data element to the <application> element of your app's AndroidManifest.xml:

<meta-data
    android:name="com.google.android.gms.wallet.api.enabled"
    android:value="true" />

Usage

import { GooglePay } from 'react-native-google-pay';

const request = {
  ...GooglePay.BaseRequest,
  allowedPaymentMethods: [
    {
      type: 'CARD',
      parameters: {
        allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
        allowedCardNetworks: ['VISA', 'MASTERCARD'],
      },
      tokenizationSpecification: {
        type: 'PAYMENT_GATEWAY',
        parameters: {
          gateway: 'example',
          gatewayMerchantId: 'exampleGatewayMerchantId',
        },
      },
    },
  ],
  merchantInfo: {
    merchantId: 'Example Merchant',
    merchantName: 'Example Merchant',
  },
  transactionInfo: {
    totalPrice: '9.99',
    totalPriceStatus: 'FINAL',
    currencyCode: 'USD',
  },
};

GooglePay.setEnvironment(GooglePay.ENVIRONMENT_TEST);

GooglePay.isReadyToPay({
  ...GooglePay.BaseRequest,
  allowedPaymentMethods: request.allowedPaymentMethods,
}).then(ready => {
  if (ready) {
    GooglePay.requestPayment(request)
      .then(paymentData => {
        const token = paymentData.paymentMethodData.tokenizationData.token;
        // Send the token to your payment gateway.
      })
      .catch(error => console.log(error.code, error.message));
  }
});

Requests use the Google Pay API objects. TypeScript types come from @types/googlepay, which this package depends on. GooglePay.BaseRequest is { apiVersion: 2, apiVersionMinor: 0 }.

requestPayment resolves with a PaymentData object. The payment token is paymentMethodData.tokenizationData.token. The promise rejects when the payer closes the sheet (PAYMENT_RESULT_CANCELED) or when Google Pay returns an error (PAYMENT_RESULT_ERROR). isReadyToPay resolves true or false. It rejects NO_ACTIVITY when the Android activity is missing, NO_PAYMENTS_CLIENT when setEnvironment has not run, and IS_READY_TO_PAY_REQUEST when the request JSON is invalid.

For a gateway integration, set tokenizationSpecification.parameters.gateway and gatewayMerchantId. Stripe uses the same PAYMENT_GATEWAY type with string parameters stripe:publishableKey and stripe:version. For type: 'DIRECT', set protocolVersion to ECv2 and publicKey. The Example app calls all three.

Example

The Example app is a React Native 0.88 project:

npm install
npm --prefix Example install
npm --prefix Example run android

The demo uses GooglePay.ENVIRONMENT_TEST.