@wojciech-dybikowski-adanto/react-native-rego-googlepay
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

react-native-rego-googlepay

React Native library for adding cards to Google Pay

Installation

npm install react-native-rego-googlepay

You also have to add Google SDK for managing Google Pay to your android project in React Native.

Usage

import AddCardButton, { RegoGooglepay } from 'react-native-rego-googlepay';
import { DeviceEventEmitter } from 'react-native';

// ...

useEffect(() => {
  RegoGooglePay.isCardAlreadyAdded(cardSuffix).then((result) => {
    console.log(result);
  });

  DeviceEventEmitter.addListener(
    'onAddToGooglePayHidden',
    onAddToWalletViewHidden
  );

  return () => {
    DeviceEventEmitter.removeListener(
      'onAddToGooglePayHidden',
      onAddToWalletViewHidden
    );
  };
}, []);

// ...

const pushProvisioning = {
  apiEndpoint: INSTANT_PROVISIONING_ENDPOINT,
  authorizationToken: AUTHORIZATION_TOKEN,
  cardDescription: CARD_DESCRIPTION,
};
const address = {
  addressLine1: ADDRESS_LINE_1,
  addressLine2: ADDRESS_LINE_2,
  locality: LOCALITY,
  name: NAME,
  administrativeArea: ADMINISTRATIVE_AREA,
  phoneNumber: PHONE_NUMBER,
  postalCode: POSTAL_CODE,
};
return (
  <AddCardButton
    style={styles.addCardToWalletButton}
    loading={isGooglePayLoading}
    onPress={() => {
      RegoGooglePay.handleAddToGooglePayClicked(pushProvisioning, address);
    }}
  />
);

License

MIT

Package Sidebar

Install

npm i @wojciech-dybikowski-adanto/react-native-rego-googlepay

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

965 kB

Total Files

179

Last publish

Collaborators

  • wojciech-dybikowski-adanto