Skip to content
React Native bridge for Apple Pay
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example update example version Jul 4, 2019
ios add promise to complete method Jul 4, 2019
.gitattributes Initial commit Jun 15, 2019
.gitignore Initial commit Jun 15, 2019
.npmignore
README.md add promise to complete method Jul 4, 2019
RNApplePay.podspec
index.d.ts add promise to complete method Jul 4, 2019
index.js Initial commit Jun 15, 2019
package.json bump version (1.3.0) Jul 4, 2019
simulator.gif Initial commit Jun 15, 2019

README.md

react-native-apay

react-native version npm npm (tag)

Accept Payments with Apple Pay for React Native apps.


Getting started

$ yarn add react-native-apay

Mostly automatic installation

$ react-native link react-native-apay

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-apay and add RNApplePay.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNApplePay.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Usage

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

You can’t perform that action at this time.