Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
178 changes: 168 additions & 10 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,11 +178,6 @@ __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
Expand Down Expand Up @@ -454,7 +612,7 @@ The sandbox environment is a great way to test offline implementation of Apple P
## 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](packages/react-native-payments/docs/ApplePayButton.md)
[Detailed docs and examples](docs/ApplePayButton.md)

## Add-ons
Here's a list of Payment Processors that you can enable via add-ons:
Expand All @@ -464,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 Down
27 changes: 27 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
lintOptions {
warning 'InvalidPackage'
}
}

dependencies {
implementation 'com.facebook.react:react-native:+'
implementation 'com.google.android.gms:play-services-base:17.0.0'
implementation 'com.google.android.gms:play-services-identity:17.0.0'
implementation 'com.google.android.gms:play-services-wallet:17.0.0'
implementation 'com.android.support:support-v4:23.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ In addition to button's type, you can set button's visual appearance. For iOS an
![Apple pay button - styles](https://user-images.githubusercontent.com/829963/40891711-daca8ff8-678a-11e8-89f2-26a0c3dcf9ed.png)

## Props
| Prop name | required | Type | Default Value |
|-----------|----------|-------------|---------------|
| type | yes | ButtonType | |
| style | yes | ButtonStyle | |
| onPress | yes | Function | |
| width | no | number | |
| height | no | number | 44 |
| Prop name | required | Type | Default Value |
|--------------|----------|-------------|---------------|
| type | yes | ButtonType | |
| style | yes | ButtonStyle | |
| onPress | yes | Function | |
| width | no | number | |
| height | no | number | 44 |
| cornerRadius | no | number | 4 |

## Types
```javascript
Expand Down
Loading