https://github.com/sorokin0andrey/react-native-apay
React Native bridge for Apple Pay
https://github.com/sorokin0andrey/react-native-apay
Last synced: 29 days ago
JSON representation
React Native bridge for Apple Pay
- Host: GitHub
- URL: https://github.com/sorokin0andrey/react-native-apay
- Owner: sorokin0andrey
- Created: 2019-06-15T16:01:43.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-08-22T18:21:57.000Z (about 2 years ago)
- Last Synced: 2025-09-26T02:25:19.864Z (about 1 month ago)
- Language: Objective-C
- Size: 3.08 MB
- Stars: 56
- Watchers: 3
- Forks: 30
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-react-native - react-native-apay ★2 - React Native bridge for Apple Pay (Components / Monetization)
README
# react-native-apay
[](https://github.com/facebook/react-native/releases/tag/v0.41.0)

[](https://github.com/busfor/react-native-apay/tree/master)
Accept Payments with Apple Pay for React Native apps.
---
## Getting started
`$ yarn add react-native-apay`
## Linking
### >= 0.60
Autolinking will just do the job.
### < 0.60
### Mostly automatic installation
`$ react-native link react-native-apay`
### CocoaPods
Link using [Cocoapods](https://cocoapods.org) by adding this to your `Podfile`:
```ruby
pod 'RNApplePay', :path => '../node_modules/react-native-apay'
```
### Manual installation
#### iOS
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `react-native-apay` and add `RNApplePay.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNApplePay.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Run your project (`Cmd+R`)<
## Usage
```javascript
import { ApplePay } from 'react-native-apay';
const requestData = {
merchantIdentifier: 'merchant.com.example',
supportedNetworks: ['mastercard', 'visa'],
countryCode: 'US',
currencyCode: 'USD',
paymentSummaryItems: [
{
label: 'Item label',
amount: '100.00',
},
],
}
// Check if ApplePay is available
if (ApplePay.canMakePayments) {
ApplePay.requestPayment(requestData)
.then((paymentData) => {
console.log(paymentData);
// Simulate a request to the gateway
setTimeout(() => {
// Show status to user ApplePay.SUCCESS || ApplePay.FAILURE
ApplePay.complete(ApplePay.SUCCESS)
.then(() => {
console.log('completed');
// do something
});
}, 1000);
});
};
```
## Demo
You can run the demo by cloning the project and running:
`$ yarn demo`