1.0.0 • Published 6 months ago

@adembacaj/react-native-apple-pay v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@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

1.0.0

6 months ago