Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a924de2
Initial commit
Jun 22, 2015
63943eb
Empty project
Jun 22, 2015
1f621b6
empty class
Jun 22, 2015
69c7f39
Working implementation and example
Jun 23, 2015
245ed9d
Adding the react-component keyword
Jun 23, 2015
da2a9f1
Adding repository key
Jun 23, 2015
5adeb17
Updating package again
Jun 23, 2015
25ab41d
Directionssssss
Jun 23, 2015
85ffab0
Passing back payment confirmation details, updating test user account…
Jun 23, 2015
df4c844
More directionsssss
Jun 23, 2015
85729a1
Update README.md
Jun 23, 2015
9b879d5
Update README.md
Jun 23, 2015
b2d2432
Update README.md
Jun 24, 2015
099dc7a
Added react-native .gitignore
amiuhle Jan 13, 2016
54b4d41
Merge in MattFoley/react-native-paypal
amiuhle Jan 13, 2016
ad1336f
Android and iOS sections in README
amiuhle Jan 13, 2016
1e8f13d
Renamed ReactPaypal => ios
amiuhle Jan 13, 2016
e3714f6
Created MFLReactNativePayPal.xcodeproj
amiuhle Jan 13, 2016
0653d9b
Create license.md
Jan 13, 2016
fb64299
Rename license.md to LICENSE.md
Jan 13, 2016
bb41bde
Update LICENSE.md
Jan 13, 2016
0408873
PayPal iOS 2.13.0
amiuhle Jan 14, 2016
dbcab7c
Added PayPalMobile and CardIO
amiuhle Jan 14, 2016
e73c131
Other Linker Flags
amiuhle Jan 14, 2016
f29a992
Merge remote-tracking branch 'ios/master' into merge-ios
amiuhle Jan 14, 2016
e84d3f1
Moved license to ios folder
amiuhle Jan 14, 2016
10a81e1
Removed test project
amiuhle Jan 14, 2016
988a09a
Merge branch 'paypal-sdk' into ios
amiuhle Jan 14, 2016
f5ddd9a
Simple payment working in iOS
amiuhle Jan 14, 2016
62e9827
Updated package.json with information from deleted ios/package.json
amiuhle Jan 14, 2016
2ecfd0c
Removed ios/index.ios.js
amiuhle Jan 14, 2016
95a4831
Updated README with iOS installation instructions
amiuhle Jan 14, 2016
5ca3a94
Finished installation instructions for iOS
amiuhle Jan 14, 2016
18e20ed
Using strings for price in iOS
amiuhle Jan 15, 2016
fac9e6b
[Android] PayPal SDK 2.13.0
amiuhle Jan 25, 2016
ce97908
Bumped version to 1.0.3
amiuhle Jan 25, 2016
c6e0c8d
Merge branch 'paypal-android-sdk-2.13.0' into ios
amiuhle Jan 25, 2016
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
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# OSX
#
.DS_Store

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

# Android/IJ
#
.idea
.gradle
local.properties

# node.js
#
node_modules/
npm-debug.log

/android/build
/android/react-native-paypal.iml
/.tern-port
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ios/lib/Paypal"]
path = ios/lib/Paypal
url = git@github.com:paypal/PayPal-iOS-SDK.git
41 changes: 38 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ A React Native interface for the PayPal Payment UI

# Setup

Android
-------

1. Add react-navive-paypal to your project

``` bash
Expand Down Expand Up @@ -145,7 +148,39 @@ PayPal.paymentRequest(...).catch(function (error_code) {
})
```

iOS
---

### TODO:
- Automated tests
- iOS version
- Future payment (subscriptions)

* [ ] Refactor & cleanup
* [ ] Automated tests
* [ ] Future payment (subscriptions)

### Installation

Currently you have to install via `npm` from GitHub (or change the version specifier in `package.json` to `zeroseven/react-native-paypal#ios`):

```shell
npm install --save zeroseven/react-native-paypal#ios
```

#### Install the PayPal-iOS-SDK

You then have to install the PayPal-iOS-SDK into `node_modules/react-native-paypal/ios/lib/Paypal`

Here's a one-liner to download and unpack version `2.13.0`:

```shell
mkdir -p node_modules/react-native-paypal/ios/lib/Paypal && curl -L --progress https://github.com/paypal/PayPal-iOS-SDK/archive/2.13.0.tar.gz | tar -xz - -C node_modules/react-native-paypal/ios/lib/Paypal --strip-components=1
```

Include PayPal as normally, following their directions. Their integration steps and iOS SDK can be found [here](https://github.com/paypal/PayPal-iOS-SDK). After doing that, also drag MFLReactNativePayPal.h and MFLReactNativePayPal.m into your project.

#### Add `MFLReactNativePayPal.xcodeproj`

Add `node_modules/react-native-paypal/ios/MFLReactNativePayPal.xcodeproj`
to the `Libraries` group in iOS and link `libMFLReactNativePayPal.a` as described in Step 2 of the
[React Native Manual Linking docs](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#manual-linking).

Follow steps 4 and 5 of [the PayPal instalation instructions](https://github.com/paypal/PayPal-iOS-SDK#if-you-dont-use-cocoapods-then), as well as the [additional steps here](https://github.com/paypal/PayPal-iOS-SDK#with-or-without-cocoapods). **This has to be done for the main app, not for the library you included.**
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ repositories {
}

dependencies {
compile 'com.facebook.react:react-native:0.16.+'
compile 'com.paypal.sdk:paypal-android-sdk:2.12.4'
compile 'com.facebook.react:react-native:0.18.+'
compile 'com.paypal.sdk:paypal-android-sdk:2.13.0'
}
40 changes: 35 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,45 @@
'use strict';
var {NativeModules, Platform} = require('react-native')
var {PayPal, MFLReactNativePayPal} = NativeModules;

var {PayPal} = require('react-native').NativeModules;
var constants;

var constants = {};
var constantNames = Object.keys(PayPal).filter(p => p == p.toUpperCase());
constantNames.forEach(c => constants[c] = PayPal[c]);
if (Platform.OS === 'android') {
constants = {};
var constantNames = Object.keys(PayPal).filter(p => p == p.toUpperCase());
constantNames.forEach(c => constants[c] = PayPal[c]);
} else {
constants = {
SANDBOX: 0,
PRODUCTION: 1,
NO_NETWORK: 2,

USER_CANCELLED: 'USER_CANCELLED',
INVALID_CONFIG: 'INVALID_CONFIG'
}
}

var functions = {
paymentRequest(payPalParameters) {
return new Promise(function(resolve, reject) {
PayPal.paymentRequest(payPalParameters, resolve, reject);
if (Platform.OS === 'android') {
PayPal.paymentRequest(payPalParameters, resolve, reject);
} else {
MFLReactNativePayPal.initializePaypalEnvironment(payPalParameters.environment, payPalParameters.clientId);
MFLReactNativePayPal.preparePaymentOfAmount(payPalParameters.price, payPalParameters.currency, payPalParameters.description);
MFLReactNativePayPal.prepareConfigurationForMerchant("Shape A Future", true, "spenden@aktion-europa-hilft.de");
MFLReactNativePayPal.presentPaymentViewControllerForPreparedPurchase((error, payload) => {
if (error) {
reject(constants.INVALID_CONFIG, error)
} else {
if (payload.status === 1) {
resolve(payload);
} else {
reject(constants.USER_CANCELLED, payload);
}
}
});
}
});
}
};
Expand Down
36 changes: 36 additions & 0 deletions ios/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[ignore]

# We fork some components by platform.
.*/*.web.js
.*/*.android.js

# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*

# Ignore react-tools where there are overlaps, but don't ignore anything that
# react-native relies on
.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
.*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js
.*/node_modules/react-tools/src/browser/ui/React.js
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
.*/node_modules/react-tools/src/event/EventPropagators.js

# Ignore commoner tests
.*/node_modules/react-tools/node_modules/commoner/test/.*

# See https://github.com/facebook/flow/issues/442
.*/react-tools/node_modules/commoner/lib/reader.js

# Ignore jest
.*/react-native/node_modules/jest-cli/.*

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js

[options]
module.system=haste

[version]
0.11.0
28 changes: 28 additions & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# OSX
#
.DS_Store

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

# node.js
#
node_modules/
npm-debug.log
27 changes: 27 additions & 0 deletions ios/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# OSX
#
.DS_Store

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

# node.js
#
node_modules/
npm-debug.log
10 changes: 10 additions & 0 deletions ios/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
```
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <tfallon@mail.depaul.edu> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Tj Fallon
* ----------------------------------------------------------------------------
*/
```
Loading