Skip to content

Commit 0d2c39a

Browse files
authored
Switches to monorepo and adds cli, stripe-addon, and braintree-addon. (naoufal#10)
* Setup lerna project * Move react-native-payments into tmp folder * Add react-native-payments * Add stripe-addon to stripe example * Update stripe example * Add react-native-payments-addon-braintree * Update stripe addon description * Update addon versions * Update gitignore * Add test project * Move project from data to ios * Add cli commands * Add cli configs to addons * Update example dependencies * Add merging of inputPaths and outputPaths on buildScriptPhases * Add main to package.json of cli * Add bin to react-native-payments * Bump versions * Update fix path bugs on cli * Bump braintree version * add npmignore to cli * Bump react-native-package version * Fix double .framework bug * Add messaging to cli * Bump packages * Remove framework headers from rnp * Add readme to cli * Add README to addons * Update main README.md * Move README to root * Update travis.yml * Update package jsons
1 parent 487cd94 commit 0d2c39a

File tree

1,050 files changed

+5508
-68499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,050 files changed

+5508
-68499
lines changed

.gitignore

+2-34
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,3 @@
1-
# System
2-
#
3-
.DS_Store
4-
5-
# Xcode
6-
#
7-
build/
8-
*.pbxuser
9-
!default.pbxuser
10-
*.mode1v3
11-
!default.mode1v3
12-
*.mode2v3
13-
!default.mode2v3
14-
*.perspectivev3
15-
!default.perspectivev3
16-
xcuserdata
17-
*.xccheckout
18-
*.moved-aside
19-
DerivedData
20-
*.hmap
21-
*.ipa
22-
*.xcuserstate
23-
24-
# npm
25-
#
261
node_modules/
27-
28-
# editors
29-
#
30-
jsconfig.json
31-
.vscode/*
32-
33-
# project
34-
#
35-
coverage
2+
npm-debug.log
3+
lerna-debug.log

.travis.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: node_js
22
node_js:
33
- "node"
4-
script:
5-
- yarn test -- --verbose --coverage
4+
env:
5+
- TEST_DIR=packages/react-native-payments
6+
script: cd $TEST_DIR && yarn && yarn test -- --verbose --coverage

README.md

+17-106
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ __Features__
1212
- __Simple.__ No more checkout forms.
1313
- __Effective__. Faster checkouts that increase conversion.
1414
- __Future-proof__. Use a W3C Standards API, supported by companies like Google, Firefox and others.
15-
- __Cross-platform.__ Share payments code between your iOS and web apps.
16-
- __Payment Processor Support__. Process payments with payment processors like Braintree and Stripe.
17-
15+
- __Cross-platform__. Share payments code between your iOS and web apps.
16+
- __Add-ons__. Easily enable support for Stripe or Braintree via add-ons.
1817

1918
<img width="280px" src="https://user-images.githubusercontent.com/1627824/27758096-9fc6bf9a-5dc1-11e7-9d8f-b2d409302fc7.gif" />
2019

@@ -24,7 +23,7 @@ __Features__
2423
- [Demo](#demo)
2524
- [Installation](#installation)
2625
- [Usage](#usage)
27-
- [Payment Processors](#payment-processors)
26+
- [Add-ons](#add-ons)
2827
- [API](#api)
2928
- [Resources](#resources)
3029
- [License](#license)
@@ -59,6 +58,8 @@ $ react-native link react-native-payments
5958
- [Requesting Contact Information](#requesting-contact-information)
6059
- [Requesting a Shipping Address](#requesting-a-shipping-address)
6160
- [Processing Payments](#processing-payments)
61+
- [Dismissing the Payment Request](#dismissing-the-payment-request)
62+
6263

6364
### Registering as a Merchant
6465
Before you can start accepting payments with Apple Pay, there are a few steps you'll need to go through:
@@ -301,14 +302,6 @@ paymentRequest.show()
301302
You can learn more about server-side decrypting of Payment Tokens on Apple's [Payment Token Format Reference](https://developer.apple.com/library/content/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html) documentation.
302303
303304
#### Processing Payments with a Payment Processor
304-
React Native Payments also supports processing payments with payment processors. There are three parts to setting up a payment processor:
305-
306-
1. Creating an Apple Pay certificate
307-
2. Adding and Linking the Payment Processor's SDK
308-
3. Adding your Payment Processor's Tokens
309-
310-
_NOTE: For payment processor specific documentation, see the [Payment Processors](#payment-processors) section._
311-
312305
When using a payment processor, you'll receive a `paymentToken` field within the `details` of the `PaymentResponse`. Use this token to charge customers with your payment processor.
313306
314307
```es6
@@ -328,97 +321,24 @@ paymentRequest.show()
328321
});
329322
```
330323
331-
## Payment Processors
332-
- [Stripe](#stripe)
333-
- [Braintree](#braintree)
334-
335-
### Stripe
336-
#### Creating an Apple Pay certificate
337-
Follow Stripe's [documentation](https://stripe.com/docs/apple-pay/apps#csr) on how to create and upload the Apple Pay certificate back to Stripe.
338-
339-
#### Adding and Linking the Stripe SDK
340-
Next, you'll need to add Stripe's SDK to your project. You can install it by following one of the methods [listed in Stripe's documentation](https://stripe.com/docs/mobile/ios#getting-started).
341-
342-
Finally, in Xcode:
343-
1. Select the `ReactNativePayments` project from the left sidebar (under Libraries)
344-
2. Select `Build Settings` and search for `Framework Search Paths`
345-
3. Then add the path to where you added the Framework (remember, it's relative to `/node_modules/react-native-payments/lib/ios`)
324+
For a list of supported payment processors and how to enable them, see the [Add-ons](#add-ons) section.
346325
347-
<img width="1000" alt="xcode-stripe" src="https://user-images.githubusercontent.com/1627824/28250182-cb47cd1e-6a17-11e7-9d67-47f35f0757bd.png">
348-
349-
#### Adding your Stripe Config
350-
Now that you've added Stripe's SDK to your app, you're setup to use Stripe as a payment processor.
351-
352-
In order to do so, you'll need to define a `paymentMethodTokenizationParameters` on your `PaymentMethodData` with Stripe specific parameters. Here's an example of what Stripe `paramaters` look like:
353-
354-
```diff
355-
const supportedMethods = [
356-
{
357-
supportedMethods: ['apple-pay'],
358-
data: {
359-
merchantIdentifier: 'merchant.com.your-app.namespace',
360-
supportedNetworks: ['visa', 'mastercard'],
361-
countryCode: 'US',
362-
currencyCode: 'USD',
363-
+ paymentMethodTokenizationParameters: {
364-
+ parameters: {
365-
+ 'gateway': 'stripe',
366-
+ 'stripe:publishableKey': 'your-publishable-key'
367-
+ }
368-
+ }
369-
}
370-
}
371-
];
372-
```
373-
374-
Now you're all set to receive Stripe payment tokens in your `PaymentResponse`.
375-
376-
### Braintree
377-
#### Creating an Apple Pay certificate
378-
Follow Braintree's [documentation](https://developers.braintreepayments.com/guides/apple-pay/configuration/ios/v4#apple-pay-certificate-request-and-provisioning) on how to create and upload the Apple Pay certificate back to Braintree.
379-
380-
#### Adding and Linking the Braintree SDK
381-
Next, you'll need to add Braintree's SDK to your project. You can install it by following one of the methods [listed in Braintree's documentation](https://github.com/braintree/braintree_ios#installation).
382-
383-
Finally, in Xcode:
384-
1. Select the `ReactNativePayments` project from the left sidebar (under Libraries)
385-
2. Select `Build Settings` and search for `Header Search Paths`
386-
3. Then add the path to where you added the Library (remember, it's relative to `/node_modules/react-native-payments/lib/ios`)
387-
388-
<img width="1000" alt="xcode-braintree" src="https://user-images.githubusercontent.com/1627824/28300092-e5a218d4-6b31-11e7-8234-8f2fdf81081b.png">
389-
390-
391-
#### Adding your Braintree Config
392-
Now that you've added Braintree's SDK to your app, you're setup to use Braintree as a payment processor.
393-
394-
In order to do so, you'll need to define a `paymentMethodTokenizationParameters` on your `PaymentMethodData` with Braintree specific parameters. Here's an example of what Braintree `paramaters` look like:
326+
### Dismissing the Payment Request
327+
Dismissing the Payment Request is as simple as calling the `complete` method on of the `PaymentResponse`.
395328
396-
```diff
397-
const supportedMethods = [
398-
{
399-
supportedMethods: ['apple-pay'],
400-
data: {
401-
merchantIdentifier: 'merchant.com.your-app.namespace',
402-
supportedNetworks: ['visa', 'mastercard'],
403-
countryCode: 'US',
404-
currencyCode: 'USD',
405-
+ paymentMethodTokenizationParameters: {
406-
+ parameters: {
407-
+ 'gateway': 'braintree',
408-
+ 'braintree:tokenizationKey': 'your-tokenization-key'
409-
+ }
410-
+ }
411-
}
412-
}
413-
];
329+
```es6
330+
paymentResponse.complete('success'); // Alternatively, you can call it with `fail` or `unknown`
414331
```
415332
416-
Now you're all set to receive Braintree payment tokens in your `PaymentResponse`.
333+
## Add-ons
334+
Here's a list of Payment Processors that you can enable via add-ons:
335+
- [Stripe](https://github.com/naoufal/react-native-payments/blob/master/cli/packages/react-native-payments-addon-stripe)
336+
- [Braintree](https://github.com/naoufal/react-native-payments/blob/master/cli/packages/react-native-payments-addon-braintree)
417337
418338
## API
419-
### [PaymentRequest](https://github.com/naoufal/react-native-payments/tree/master/docs/PaymentRequest.md)
420-
### [PaymentRequestUpdateEvent](https://github.com/naoufal/react-native-payments/tree/master/docs/PaymentRequestUpdateEvent.md)
421-
### [PaymentResponse](https://github.com/naoufal/react-native-payments/tree/master/docs/PaymentResponse.md)
339+
### [PaymentRequest](https://github.com/naoufal/react-native-payments/blob/master/cli/packages/react-native-payments/docs/PaymentRequest.md)
340+
### [PaymentRequestUpdateEvent](https://github.com/naoufal/react-native-payments/blob/master/cli/packages/react-native-payments/docs/PaymentRequestUpdateEvent.md)
341+
### [PaymentResponse](https://github.com/naoufal/react-native-payments/blob/master/cli/packages/react-native-payments/docs/PaymentResponse.md)
422342
423343
## Resources
424344
### Payment Request
@@ -434,15 +354,6 @@ Now you're all set to receive Braintree payment tokens in your `PaymentResponse`
434354
- [Processing Payments](https://developer.apple.com/library/content/ApplePay_Guide/ProcessPayment.html#//apple_ref/doc/uid/TP40014764-CH5-SW4)
435355
- [Payment Token Format Reference](https://developer.apple.com/library/content/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html#//apple_ref/doc/uid/TP40014929)
436356
437-
### Gateways
438-
#### Stripe
439-
- [Creating a new Apple Pay certificate](https://stripe.com/docs/apple-pay/apps#csr)
440-
- [Installing the Stripe SDK](https://stripe.com/docs/mobile/ios#getting-started)
441-
442-
#### Braintree
443-
- [Creating a new Apple Pay certificate](https://developers.braintreepayments.com/guides/apple-pay/configuration/ios/v4#apple-pay-certificate-request-and-provisioning)
444-
- [Installing the Braintree SDK](https://github.com/braintree/braintree_ios#installation)
445-
446357
447358
# License
448359
Licensed under the MIT License, Copyright © 2017, [Naoufal Kadhom](https://twitter.com/naoufal).

examples/braintree/ios/Frameworks/Braintree/.gitattributes

-1
This file was deleted.

examples/braintree/ios/Frameworks/Braintree/.github/issue_template.md

-10
This file was deleted.

examples/braintree/ios/Frameworks/Braintree/.gitignore

-36
This file was deleted.

examples/braintree/ios/Frameworks/Braintree/.ruby-gemset

-1
This file was deleted.

examples/braintree/ios/Frameworks/Braintree/.ruby-version

-1
This file was deleted.

examples/braintree/ios/Frameworks/Braintree/.swift-version

-1
This file was deleted.

examples/braintree/ios/Frameworks/Braintree/.travis.yml

-27
This file was deleted.

examples/braintree/ios/Frameworks/Braintree/ACKNOWLEDGEMENTS.md

-17
This file was deleted.

0 commit comments

Comments
 (0)