Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
3b0998a
Fix/braintree ios (#51)
Andreyco Dec 5, 2017
cca4f95
Fix canMakePayments() (#39)
Dec 18, 2017
5254df6
[iOS] Fix issue when `paymentToken` is not present on real iOS device…
Andreyco Jan 13, 2018
d23d3f2
[iOS] Don't use unavailable payment networks. (#34)
Andreyco Jan 13, 2018
fb8692f
fix(typo): spelling of paymentToken (#44)
ifiokjr Jan 13, 2018
6821709
Remove prettier lint-stage from rnp package
naoufal Jan 13, 2018
11ed89a
Use npm instead of yarn
naoufal Jan 13, 2018
1ea9cb2
namespace addons
naoufal Jan 13, 2018
913c769
Propose fix some typos (#73)
jeis2497052 Feb 27, 2018
49dc187
Reformat only
Andreyco May 10, 2018
d2c046e
Present PKPaymentAuthorizationViewController on presented VC
Andreyco May 10, 2018
340d520
Sync package versions
Andreyco May 10, 2018
c24709f
0.5.0
Andreyco May 13, 2018
7a41d53
Render basic UIButton
Andreyco May 15, 2018
c7099df
Render basic PKPaymentButton
Andreyco May 15, 2018
ad7faae
Set default button height to 44 points
Andreyco May 15, 2018
7a00fe5
add default type and style props for button
Andreyco May 15, 2018
abf3bc4
Pass down all props.
Andreyco May 15, 2018
7617f9a
Add `disabled` prop just for sake of learning
Andreyco May 15, 2018
03d6cbd
Refactor
Andreyco May 15, 2018
bb08db8
Add `onPress` handler
Andreyco May 16, 2018
2ce6874
Method name refactor
Andreyco Jun 1, 2018
9f5ac45
Implement mechanism to update button type.and style
Andreyco Jun 1, 2018
2150959
Refactor view manager to match button functionality
Andreyco Jun 1, 2018
a3c49b3
Add typings to JS codebase
Andreyco Jun 1, 2018
5b2bcb2
Add interactive example
Andreyco Jun 1, 2018
f5aabf9
Remove leftovers after learning & debug session
Andreyco Jun 1, 2018
4dd1ae5
Cleanup commented code
Andreyco Jun 1, 2018
7f322a4
Add multi-button demo
Andreyco Jun 1, 2018
6540126
Format
Andreyco Jun 3, 2018
e828fe9
Do not cache view instances
Andreyco Jun 3, 2018
ce7c420
Refactor button management
Andreyco Jun 3, 2018
4d609dc
Refactor class names
Andreyco Jun 3, 2018
87bc728
Move files around
Andreyco Jun 3, 2018
ebca79d
Update component JS API
Andreyco Jun 3, 2018
87288a1
Update docs
Andreyco Jun 3, 2018
7039ad1
Reset example to original state
Andreyco Jun 3, 2018
60eb18b
Merge branch 'feature/apple-pay-button' into develop
Andreyco Jun 3, 2018
bc0f80e
Place view related codebase in own group
Andreyco Jun 3, 2018
e102dd5
Release 0.6.0
Andreyco Jun 3, 2018
67b0e67
Broaden `react` and `react-native` versions for React Native apps
Andreyco Jun 6, 2018
43105a3
Upgrade react-native example app and link RNP
Andreyco Jun 6, 2018
c0d78b1
Fix regresion related to exporting PaymentRequest
Andreyco Jun 6, 2018
7e9c4fa
0.7.0
Andreyco Jun 6, 2018
bc8d9c0
Merge commit '7e9c4faefb43f953c932bfb0770fbd7673bde4d6'
Andreyco Jun 6, 2018
2cdfa23
Update new native example (#94)
Andreyco Jun 6, 2018
83615f7
update podspec (#80)
barbieri Jun 6, 2018
327bc3f
fix #67 (#96)
klapperkopp Jun 8, 2018
da34b2e
Do not fail if native module is unavailable (#42)
Jun 8, 2018
2feff8c
Update README.md (#97)
hyochan Jun 13, 2018
abc18d1
require main queue setup (#129)
zibs Nov 8, 2018
af46a23
Release 0.7.1
Andreyco Nov 8, 2018
2dbc279
Feature/pkpaymentbutton corner radius (#179)
ds8k Nov 17, 2020
fbfd457
Allow 0 as a total for payment (#138)
zibs Nov 17, 2020
07d4b92
(1 line fix) Allow library to be imported from CocoaPods (closes #132…
nabilfreeman Nov 17, 2020
95ebe5b
Add billingContact and shippingContact to paymentResponse on iOS (#118)
mitchmartinbb Nov 17, 2020
f4d895c
Added static canMakePaymentsUsingNetworks method (#106)
Nov 17, 2020
8c36fad
Fix loss of exception in NativePayments.show() (#43)
Nov 17, 2020
8e160e7
0.8 refactor (#250)
nabilfreeman Nov 18, 2020
6dc67cc
Revert js exports to what they were before, slightly beyond my unders…
runticle Nov 19, 2020
844c18e
0.8.1 bump
nabilfreeman Nov 20, 2020
3ab111d
fix (#260)
ARDcode Dec 1, 2020
224e5ab
bump to 0.8.2
nabilfreeman Dec 2, 2020
ac92d87
Add paymentMethod to ApplePay's PaymentResponse (#86)
madoke Jan 11, 2021
7c75a77
bump to 0.8.3
nabilfreeman Feb 4, 2021
107ad3d
Update broken links (#275)
rakeshpetit Mar 1, 2021
296ecb9
Do not trigger a ShippingOption reset if the original event is actual…
nmilcoff Apr 13, 2021
3390fd8
Bump validator dependency version to remove vulnerability. (#278)
mbovahqo Apr 13, 2021
99feafd
? syntax doesn't work, changed to pure JS
nabilfreeman Apr 13, 2021
68cadfd
fix: make PaymentRequest.abort actually return Promise<void> (#282)
wkoutre Apr 13, 2021
2ec7f2b
Wrong repository URL in podspec (#291)
kowalski May 25, 2021
472493e
pin dependencies to specific versions (especially for Stripe new vers…
nabilfreeman May 25, 2021
9cc30fc
Merge branch 'master' of https://github.com/naoufal/react-native-paym…
nabilfreeman May 25, 2021
7acd339
Update README.md
nabilfreeman Dec 26, 2022
578f55e
use remove function instead of removeSubscription :bug: (#365)
mouessam Dec 27, 2022
22fbfa9
Update README.md
nabilfreeman Mar 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
65 changes: 65 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const IGNORE = 0;
const WARN = 1;
const ERROR = 2;

module.exports = {
"extends": "airbnb-base",
"parser": "babel-eslint",
"plugins": [
"flowtype"
],
"rules": {
"import/no-named-as-default-member": IGNORE,
"import/no-named-as-default": IGNORE,
"no-tabs": IGNORE,
"camelcase": IGNORE,
"no-console": IGNORE,
"no-param-reassign": IGNORE,
"import/prefer-default-export": IGNORE,
"consistent-return": IGNORE,
"max-len": IGNORE,
"no-continue": IGNORE,
'no-case-declarations': IGNORE,
"indent": [ERROR, 2, { "SwitchCase": 1, "VariableDeclarator": 1, "ignoredNodes": ["TemplateLiteral > *"] }],
"class-methods-use-this": IGNORE,
"no-restricted-syntax": IGNORE,
"prefer-template": IGNORE,
"no-plusplus": IGNORE,
"default-case": IGNORE,
"no-useless-constructor": IGNORE,
"jsx-a11y/accessible-emoji": IGNORE,
"no-use-before-define": IGNORE,
"curly": IGNORE,
"no-unused-expressions": [ERROR, { "allowShortCircuit": true }],
"prefer-destructuring": IGNORE,
"no-await-in-loop": IGNORE,
"global-require": IGNORE,
"func-names": IGNORE,
"linebreak-style": IGNORE,
"no-empty-function": IGNORE,
"no-labels": IGNORE,
"func-names": IGNORE,
"guard-for-in": IGNORE,
"radix": IGNORE,
"import/no-dynamic-require": IGNORE,
"quote-props": IGNORE,
"no-shadow": IGNORE,
"no-extra-label": IGNORE,
"arrow-parens": IGNORE,
"quotes": IGNORE,
"prefer-rest-params": IGNORE,
"no-nested-ternary": IGNORE,
"newline-per-chained-call": IGNORE,
"no-restricted-globals": IGNORE,
"dot-notation": IGNORE,
"arrow-body-style": IGNORE,
"no-loop-func": IGNORE,
"no-useless-escape": IGNORE,
"no-trailing-spaces": IGNORE,
"import/order": IGNORE,
"no-lonely-if": IGNORE,
},
"env": {
"jest": true
},
};
File renamed without changes.
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
# System
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

# Android
**/android/**/.idea
**/android/**/*.iml
**/android/**/gradlew*
**/android/**/*.properties
**/android/**/.gradle
**/android/**/gradle
**/android/**/.settings
**/android/**/.project

# npm
#
node_modules/
npm-debug.log
lerna-debug.log

# editors
#
jsconfig.json
.vscode/*
.idea
*.iml

# project
#
coverage
File renamed without changes.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
language: node_js
node_js:
- "node"
env:
- TEST_DIR=packages/react-native-payments
script: cd $TEST_DIR && yarn && yarn test -- --verbose --coverage
script: npm test -- --verbose --coverage
208 changes: 192 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,166 @@
# react-native-payments

[![Codeship Status for freeman-industries/react-native-payments](https://app.codeship.com/projects/d6d17e65-23f0-4154-b7ce-33ce59471b08/status?branch=master)](https://app.codeship.com/projects/418096)

# 🚨 Important notice 🚨

This project is no longer maintained. The good news is that the landscape of payments on React Native has massively changed in the last few years. There is still room for this repo to evolve which I'll detail below, but first I would like to direct your attention to well-funded and well-maintained alternatives that will give you fewer grey hairs.

## Stripe
- Stripe has released an official React Native SDK supporting Apple Pay that has a huge team of paid engineers behind it.
- It has also been included in the [Expo managed environment](https://docs.expo.dev/versions/latest/sdk/stripe/), which means it works on Expo Go. Huge achievement.
- For a bug free experience and easy integration I strongly recommend you use [@stripe/stripe-react-native](https://github.com/stripe/stripe-react-native) on any new projects.
- More information and discussion in this issue: https://github.com/naoufal/react-native-payments/issues/335

## Community forks and alternatives

### Braintree
- At time of writing, there an actively maintained Braintree RN SDK.
- Check it out: https://github.com/ekreative/react-native-braintree
- More information and discussion in this issue: https://github.com/naoufal/react-native-payments/issues/405

### Other forks
- Most notably there is a long running active fork of this library by Appfolio.
- Check it out: https://github.com/appfolio/react-native-payments
- Other projects and discussion in this issue: https://github.com/naoufal/react-native-payments/issues/406

## Future of this library

The scope of this library should probably change to:

- Support networks and products unavailable within Stripe
- Stick to the principles of the PaymentRequest open interface

If you want to own that direction, please get in touch.

- [@naoufal](https://twitter.com/naoufal) (project owner) on Twitter (sometimes difficult to get hold of)
- Me, Nabs (afk maintainer) on [my LinkedIn](https://linkedin.com/in/nabilfreeman) (I also have Twitter [@NabsFreeman](https://twitter.com/NabsFreeman), but I think Elon shadowbanned me during the whole jet thing)

Naoufal is the only administrator and he needs to appoint authors and maintainers. I can commit and merge PRs to help any new maintainer get started.

Nabs

On to the old README...

# Introduction

Welcome to the best and most comprehensive library for integrating payments like Apple Pay and Google Pay into your React Native app.

This library is designed to be fully compatible with React Native 0.61 and onwards.

<div>
<img width="200px" src="https://user-images.githubusercontent.com/1627824/27758096-9fc6bf9a-5dc1-11e7-9d8f-b2d409302fc7.gif" />
<img width="200px" src="https://user-images.githubusercontent.com/1627824/30039983-d75d1b3e-91d8-11e7-9ac9-71d2ed12958c.png" />
</div>

# Installation

```
npm install --save react-native-payments
```

You'll need to autolink on each platform:

### Android

```
npx jetify
```

### iOS

```
cd ios
pod install
```

# Guides

## Example projects

- [iOS](https://github.com/freeman-industries/react-native-payments-example-ios)

## Live demo

For a step by step guide, check out this talk by @naoufal.

https://www.youtube.com/watch?v=XrmUuir9OHc&t=652

## API Spec

Down below we have a detailed specification for PaymentRequest and instructions for configuring Apple Pay and Google Pay, which is hopefully enough to get you started.

We also have some legacy example projects in the `examples` directory that will be rewritten soon and linked above.

Bear with us while we organize things a bit.

# Roadmap

## Completed

- Apple Pay Stripe

## Completed, untested

- Apple Pay Braintree
- Google Pay (Stripe, Braintree)
- Web

## In progress

- Stripe: Payment Intents (for SCA)

## Planned

- Tutorial docs

Naoufal, the original author of this library, has done a lot of the hard work integrating iOS, Android, Web platforms and Stripe and Braintree gateways.

The library has fallen out of regular maintenance and we're working to test and update all parts to be compatible for RN in the 2020s.

If you're feeling brave give the untested platforms a try and let us know how it worked.

# Contributors

Many people have contributed to the development of `react-native-payments` over time. The people below are currently available to help.

- [@nabilfreeman](https://github.com/nabilfreeman) ⚙️ ✏️
- [@runticle](https://github.com/runticle) ✏️

---
Merge PRs: ⚙️ | Review issues: ✏️

## Join us!

All contributions, big or small are welcomed.

For large PRs, please open an issue and have a discussion with us first before you dive in.

Our plan for this library is for it to be useful to all React Native developers so we want to architect it carefully.

# In the wild

These amazing people use `react-native-payments` in their projects.

- [LeSalon (@lesalonapp)](https://github.com/lesalonapp)
- [Truphone (My Truphone App)](https://truphone.com/consumer/esim-for-smartphone)

To add your organization, open a PR updating this list.

---

🚧

🚧

🚧

🚧

🚧

---

> This project is currently in __beta and APIs are subject to change.__

# React Native Payments
Expand All @@ -15,17 +178,14 @@ __Features__
- __Cross-platform__. Share payments code between your iOS, Android, and web apps.
- __Add-ons__. Easily enable support for Stripe or Braintree via add-ons.

<div>
<img width="280px" src="https://user-images.githubusercontent.com/1627824/27758096-9fc6bf9a-5dc1-11e7-9d8f-b2d409302fc7.gif" />
<img width="280px" src="https://user-images.githubusercontent.com/1627824/30039983-d75d1b3e-91d8-11e7-9ac9-71d2ed12958c.png" />
</div>

---

## Table of Contents
- [Demo](#demo)
- [Installation](#installation)
- [Usage](#usage)
- [Testing Payments](#testing-payments)
- [Apple Pay button](#apple-pay-button)
- [Add-ons](#add-ons)
- [API](#api)
- [Resources](#resources)
Expand Down Expand Up @@ -79,7 +239,7 @@ Apple has a documentation on how to do this in their _[Configuring your Environm
1. Add Android Pay and Google Play Services to your dependencies
1. Enable Android Pay in your Manifest

Google has documentation on how to do this in their _[Setup Android Pay](https://developers.google.com/android-pay/setup)_ guide.
Google has documentation on how to do this in their _[Setup Android Pay](https://developers.google.com/pay/api/android/guides/setup)_ guide.

### Importing the Library
Once Apple Pay/Android Pay is enabled in your app, jump into your app's entrypoint and make the `PaymentRequest` globally available to your app.
Expand Down Expand Up @@ -326,20 +486,22 @@ paymentRequest.show()
There are two ways to process Apple Pay/Android Pay payments -- on your server or using a payment processor.

#### Processing Payments on Your Server
If you're equiped to process Apple Pay/Android Pay payments on your server, all you have to do is send the Payment Response data to your server.
If you're equipped to process Apple Pay/Android Pay payments on your server, all you have to do is send the Payment Response data to your server.

> ⚠️ **Note:** When running Apple Pay on simulator, `paymentData` equals to `null`.

```es6
import { NativeModules } from 'react-native';

paymentRequest.show()
.then(paymentResponse => {
const { transactionIdentifier, serializedPaymentData } = paymentResponse.details;
const { transactionIdentifier, paymentData } = paymentResponse.details;

return fetch('...', {
method: 'POST',
body: {
transactionIdentifier,
serializedPaymentData
paymentData
}
})
.then(res => res.json())
Expand Down Expand Up @@ -438,6 +600,20 @@ paymentResponse.complete('success'); // Alternatively, you can call it with `fai

🚨 _Note: On Android, there is no need to call `paymentResponse.complete` -- the PaymentRequest dismisses itself._

## Testing Payments

### Apple Pay

The sandbox environment is a great way to test offline implementation of Apple Pay for apps, websites, and point of sale systems. Apple offers [detailed guide](https://developer.apple.com/support/apple-pay-sandbox/) for setting up sandbox environment.
> ⚠️ **Note:** It is also important to test Apple Pay in your production environment. Real cards must be used in the production environment. Test cards will not work.
>
> ⚠️ **Note:** There are known differences when running Apple Pay on simulator and real device. Make sure you test Apple Pay on real device before going into production.

## Apple Pay Button

Provides a button that is used either to trigger payments through Apple Pay or to prompt the user to set up a card.
[Detailed docs and examples](docs/ApplePayButton.md)

## Add-ons
Here's a list of Payment Processors that you can enable via add-ons:
- [Stripe](https://github.com/naoufal/react-native-payments/blob/master/packages/react-native-payments-addon-stripe)
Expand All @@ -446,10 +622,10 @@ Here's a list of Payment Processors that you can enable via add-ons:
🚨 _Note: On Android, Payment Processors are enabled by default._

## API
### [NativePayments](https://github.com/naoufal/react-native-payments/blob/master/packages/react-native-payments/docs/NativePayments.md)
### [PaymentRequest](https://github.com/naoufal/react-native-payments/blob/master/packages/react-native-payments/docs/PaymentRequest.md)
### [PaymentRequestUpdateEvent](https://github.com/naoufal/react-native-payments/blob/master/packages/react-native-payments/docs/PaymentRequestUpdateEvent.md)
### [PaymentResponse](https://github.com/naoufal/react-native-payments/blob/master/packages/react-native-payments/docs/PaymentResponse.md)
### [NativePayments](docs/NativePayments.md)
### [PaymentRequest](docs/PaymentRequest.md)
### [PaymentRequestUpdateEvent](docs/PaymentRequestUpdateEvent.md)
### [PaymentResponse](docs/PaymentResponse.md)

## Resources
### Payment Request
Expand All @@ -466,9 +642,9 @@ Here's a list of Payment Processors that you can enable via add-ons:
- [Payment Token Format Reference](https://developer.apple.com/library/content/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html#//apple_ref/doc/uid/TP40014929)

### Android Pay
- [Setup Android Pay](https://developers.google.com/android-pay/setup)
- [User Flows](https://developers.google.com/android-pay/payment-flows)
- [Best Practices](https://developers.google.com/android-pay/best-practices)
- [Setup Android Pay](https://developers.google.com/pay/api/android/guides/setup)
- [Tutorial](https://developers.google.com/pay/api/android/guides/tutorial)
- [Brand Guidelines](https://developers.google.com/pay/api/android/guides/brand-guidelines)
- [Gateway Token Approach](https://developers.google.com/web/fundamentals/discovery-and-monetization/payment-request/android-pay#gateway_token_approach)
- [Network Token Approach](https://developers.google.com/web/fundamentals/discovery-and-monetization/payment-request/android-pay#network_token_approach)

Expand Down
Loading