Socket
Book a DemoInstallSign in
Socket

react-native-apay

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-apay

React Native bridge for Apple Pay

1.3.1
latest
Source
npmnpm
Version published
Weekly downloads
409
48.19%
Maintainers
1
Weekly downloads
 
Created
Source

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

Linking

>= 0.60

Autolinking will just do the job.

< 0.60

Mostly automatic installation

$ react-native link react-native-apay

CocoaPods

Link using Cocoapods by adding this to your Podfile:

pod 'RNApplePay', :path => '../node_modules/react-native-apay'

Manual installation

iOS

  • In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  • Go to node_modulesreact-native-apay and add RNApplePay.xcodeproj
  • In XCode, in the project navigator, select your project. Add libRNApplePay.a to your project's Build PhasesLink Binary With Libraries
  • 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

Keywords

react-native

FAQs

Package last updated on 09 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.