@adembacaj/react-native-apple-pay
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@adembacaj/react-native-apple-pay

Apple Pay native modules for React-Native

Installation

npm install @adembacaj/react-native-apple-pay
or
yarn add @adembacaj/react-native-apple-pay

iOS Extra Actions

npx pod-install
or
cd ios && pod install

Check canMakeApplePayPayments

Before using Apple Pay, if you want to enable/disable or show/hide Apple Pay button, you need to call this function to check if device is ready to pay or not.

import { canMakeApplePayPayments } from '@adembacaj/react-native-apple-pay';

const canPayWithApple: boolean = await canMakeApplePayPayments();

Direct Apple Payment

You can use different payment gateways, but you can also use direct payment.

import { makeApplePayPayment } from '@adembacaj/react-native-apple-pay';

// ...
//Check if device/creditcard is ready to pay
if (canPayWithApple) {
  const result = await makeApplePayPayment(100, 'USD', 'Test', 'Test');
  Alert.alert('Results', results);
}

ApplePayButton

You can also use Apple Pay Button.

import { ApplePayButton } from 'react-native-apple-pay';

const App = () => {
  return (
    <ApplePayButton
      buttonType={'plain'} // 'plain' | 'inStore' | 'buy' | 'setUp'
      buttonStyle={'black'} // 'black' | 'white' | 'whiteOutline'
      onPress={() => console.log('payWithApple')}
      width={120}
      height={44}
      cornerRadius={4}
    />
  );
};

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

Dependencies (0)

    Dev Dependencies (21)

    Package Sidebar

    Install

    npm i @adembacaj/react-native-apple-pay

    Weekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    42 kB

    Total Files

    52

    Last publish

    Collaborators

    • adembacaj