Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final PR from aspect-apps #8

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
c16b2d0
Setup Intent Android Implemented
0xamogh Aug 14, 2020
65fc8df
Bug fixes
0xamogh Aug 15, 2020
6b81dbd
Setup Intents removed
0xamogh Aug 15, 2020
89378a6
Build folder generated
0xamogh Aug 16, 2020
30147ad
Testing 2.0
0xamogh Aug 16, 2020
0718938
Gitignore updated
0xamogh Aug 16, 2020
dd99012
Fixes
0xamogh Aug 17, 2020
1073bf8
Add setupPayment iOS
ChesterSim Aug 23, 2020
1c23892
Fix broken code for iOS confirmSetup
ChesterSim Aug 25, 2020
72e50b6
Enabled multidex on Android
sagarshakya Aug 25, 2020
8cc3721
Complete confirmPayment for iOS
ChesterSim Aug 26, 2020
e410d88
Merge branch 'master' of github.com:aspect-apps/react-native-stripe-p…
ChesterSim Aug 26, 2020
0396689
Add card provider
ChesterSim Aug 26, 2020
4a47a8b
Build for card provider
ChesterSim Aug 26, 2020
fe8555b
Fix card provider
ChesterSim Aug 26, 2020
542e48d
Update confirmPayment to use createWithCardParams for iOS
ChesterSim Aug 26, 2020
017cebc
Split confirmPayment into confirmPaymentWithPaymentMethodId and confi…
ChesterSim Aug 27, 2020
f0e4a46
Update README.md
ChesterSim Aug 27, 2020
8993ad7
Update README.md
ChesterSim Aug 27, 2020
a4f886b
Update README.md
Aug 27, 2020
3384ec9
Split StripePaymentsModule.java confirmPayment
ChesterSim Aug 30, 2020
c3893f3
Merge branch 'master' of github.com:aspect-apps/react-native-stripe-p…
ChesterSim Aug 30, 2020
a42f6cd
Updated Pod Minimum Target
Sep 4, 2020
fa95bd5
Updated to be more inline with the iOS implementation
Sep 4, 2020
d5df02a
Update confirmSetupIntent return object
0xamogh Sep 4, 2020
d544dce
Merge pull request #1 from amogh-jrules/master
0xamogh Sep 4, 2020
393b94a
last4 added
0xamogh Sep 4, 2020
2f0d42f
Merge pull request #2 from amogh-jrules/master
0xamogh Sep 4, 2020
d8a39f3
Build for Amogh's commit
ChesterSim Sep 4, 2020
57d1e31
Removed Redundant values from iOS
Sep 4, 2020
824493e
Updating setupIntentResult object
0xamogh Sep 4, 2020
7dd4af1
Merge remote-tracking branch 'aspect-apps-origin/master'
0xamogh Sep 4, 2020
a932d06
Built Typescript files
Sep 4, 2020
e9b7134
Returning created from Native Android
0xamogh Sep 4, 2020
0937281
Merge remote-tracking branch 'aspect-apps-origin/master'
0xamogh Sep 4, 2020
d903fdc
Built Typescript files
Sep 4, 2020
7a71db9
Updated exp month / year to match TS
Sep 4, 2020
0e462e0
Updated exp month / year
Sep 4, 2020
b08f878
Updated exp month / year
Sep 4, 2020
f792d09
Updated TS definitions
Sep 4, 2020
759b7c1
Built Typescript files
Sep 4, 2020
90fc763
Fixed Types on Return Methods
Sep 4, 2020
d706435
Android native debug
0xamogh Sep 4, 2020
a899707
Merge remote-tracking branch 'aspect-apps-origin/master'
0xamogh Sep 4, 2020
6c675b0
docs: update README.md [skip ci]
allcontributors[bot] Sep 6, 2020
be8134f
docs: create .all-contributorsrc [skip ci]
allcontributors[bot] Sep 6, 2020
f7546b4
Merge pull request #3 from aspect-apps/all-contributors/add-lukebrand…
0xamogh Sep 6, 2020
6657256
docs: update README.md [skip ci]
allcontributors[bot] Sep 6, 2020
50bcf1f
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Sep 6, 2020
0fef763
Merge pull request #7 from aspect-apps/all-contributors/add-ChesterSim
0xamogh Sep 6, 2020
cf3d99a
docs: update README.md [skip ci]
allcontributors[bot] Sep 6, 2020
c6fcb21
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Sep 6, 2020
d21e764
Merge pull request #8 from aspect-apps/all-contributors/add-amogh-jrules
0xamogh Sep 6, 2020
8c733ee
Updated gitignore to include build
0xamogh Sep 23, 2020
026d012
Removing build folder and updated gitignore
0xamogh Sep 23, 2020
ef393c6
fixing entry point not found issue
rodriigovieira Sep 24, 2020
de45b01
docs: update README.md [skip ci]
allcontributors[bot] Sep 24, 2020
91f2e30
docs: update .all-contributorsrc [skip ci]
allcontributors[bot] Sep 24, 2020
dfa9c8c
Merge pull request #10 from aspect-apps/all-contributors/add-rodriigo…
0xamogh Sep 24, 2020
fa521b2
Build folder
Oct 26, 2020
bdbe23f
Build folder
Oct 26, 2020
f53fac8
removed prepublish
Oct 26, 2020
ef0bdf1
Moved @types deps
Oct 27, 2020
d4f58f4
reversed changes
Oct 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"files": [
"README.md"
],
"imageSize": 100,
"commit": false,
"contributors": [
{
"login": "lukebrandonfarrell",
"name": "Luke Brandon Farrell",
"avatar_url": "https://avatars3.githubusercontent.com/u/18139277?v=4",
"profile": "http://www.lukebrandonfarrell.com",
"contributions": [
"code",
"infra",
"projectManagement"
]
},
{
"login": "ChesterSim",
"name": "Chester Sim",
"avatar_url": "https://avatars2.githubusercontent.com/u/12388321?v=4",
"profile": "https://github.com/ChesterSim",
"contributions": [
"doc",
"code"
]
},
{
"login": "amogh-jrules",
"name": "Amogh Jahagirdar",
"avatar_url": "https://avatars3.githubusercontent.com/u/31567169?v=4",
"profile": "https://jramogh.co",
"contributions": [
"doc",
"code"
]
},
{
"login": "rodriigovieira",
"name": "Rodrigo Vieira",
"avatar_url": "https://avatars1.githubusercontent.com/u/7014073?v=4",
"profile": "https://github.com/rodriigovieira",
"contributions": [
"bug"
]
}
],
"contributorsPerLine": 7,
"projectName": "react-native-stripe-payments",
"projectOwner": "aspect-apps",
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true
}
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ yarn-error.log

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
Expand All @@ -30,7 +29,6 @@ project.xcworkspace

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
Expand Down
82 changes: 72 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
![React Native Stripe payments](https://raw.githubusercontent.com/Fitpassu/react-native-stripe-payments/master/react-native-stripe-payments.png)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

A well typed React Native library providing support for Stripe payments on both iOS and Android.

Expand All @@ -20,49 +23,108 @@ The library ships with platform native code that needs to be compiled together w

## Usage

### Setup

First of all you have to obtain Stripe account [publishabe key](https://stripe.com/docs/keys). And then you need to set it for module.
To use the module, import it first.

```javascript
import stripe from 'react-native-stripe-payments';
```

### Setup

First of all you have to obtain a Stripe account [publishable key](https://stripe.com/docs/keys), which you need to set it for the module.

```javascript
stripe.setOptions({ publishingKey: 'STRIPE_PUBLISHING_KEY' });
```

### Validate the given card details

```javascript
import stripe from 'react-native-stripe-payments';

const isCardValid = stripe.isCardValid({
number: '4242424242424242',
expMonth: 10,
expYear: 21,
cvc: '888',
});
```
The argument for `isCardValid` is of type `CardParams`, which is used across the other APIs.

### One-time payments
### Set up a payment method for future payments (Setup Intent)

```javascript
import stripe from 'react-native-stripe-payments';
stripe.confirmSetup('client_secret_from_backend', cardParams)
.then(result => {
// result of type SetupIntentResult
// {
// paymentMethodId,
// liveMode,
// last4,
// created,
// brand
// }
})
.catch(err =>
// error performing payment
)
```
The `brand` is the provider of the card, and we use the [module](https://www.npmjs.com/package/credit-card-type) `credit-card-type` to achieve that.

### One-time payment using the `id` of a `PaymentMethod`

```javascript
stripe.confirmPaymentWithPaymentMethodId('client_secret_from_backend', paymentMethodId)
.then(result => {
// result of type PaymentResult
// {
// id,
// paymentMethodId
// }
})
.catch(err =>
// error performing payment
)
```

### One-time payment using `cardParams`

```javascript
const cardDetails = {
number: '4242424242424242',
expMonth: 10,
expYear: 21,
cvc: '888',
}
stripe.confirmPayment('client_secret_from_backend', cardDetails)
stripe.confirmPaymentWithCardParams('client_secret_from_backend', cardParams)
.then(result => {
// result of type PaymentResult
// {
// id,
// paymentMethodId
// }
})
.catch(err =>
// error performing payment
)
```

### Reusing cards
## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="http://www.lukebrandonfarrell.com"><img src="https://avatars3.githubusercontent.com/u/18139277?v=4" width="100px;" alt=""/><br /><sub><b>Luke Brandon Farrell</b></sub></a><br /><a href="https://github.com/aspect-apps/react-native-stripe-payments/commits?author=lukebrandonfarrell" title="Code">💻</a> <a href="#infra-lukebrandonfarrell" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#projectManagement-lukebrandonfarrell" title="Project Management">📆</a></td>
<td align="center"><a href="https://github.com/ChesterSim"><img src="https://avatars2.githubusercontent.com/u/12388321?v=4" width="100px;" alt=""/><br /><sub><b>Chester Sim</b></sub></a><br /><a href="https://github.com/aspect-apps/react-native-stripe-payments/commits?author=ChesterSim" title="Documentation">📖</a> <a href="https://github.com/aspect-apps/react-native-stripe-payments/commits?author=ChesterSim" title="Code">💻</a></td>
<td align="center"><a href="https://jramogh.co"><img src="https://avatars3.githubusercontent.com/u/31567169?v=4" width="100px;" alt=""/><br /><sub><b>Amogh Jahagirdar</b></sub></a><br /><a href="https://github.com/aspect-apps/react-native-stripe-payments/commits?author=amogh-jrules" title="Documentation">📖</a> <a href="https://github.com/aspect-apps/react-native-stripe-payments/commits?author=amogh-jrules" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/rodriigovieira"><img src="https://avatars1.githubusercontent.com/u/7014073?v=4" width="100px;" alt=""/><br /><sub><b>Rodrigo Vieira</b></sub></a><br /><a href="https://github.com/aspect-apps/react-native-stripe-payments/issues?q=author%3Arodriigovieira" title="Bug reports">🐛</a></td>
</tr>
</table>

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

Not supported yet, though as we're highly invested in development of our product which depends on this library we'll do it as soon as possible!
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
2 changes: 2 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ android {
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
versionCode 1
versionName "1.0"
multiDexEnabled true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this just a precaution or did you face any issues?

}
lintOptions {
abortOnError false
Expand All @@ -74,6 +75,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation 'com.stripe:stripe-android:14.2.1'
implementation 'com.android.support:multidex:1.0.3'
}

def configureReactNativePom(def pom) {
Expand Down
Loading