react-native-paypal-integration

1.1.1 • Public • Published

react-native-paypal-integration

Installation

npm install --save react-native-paypal-integration

Android

  1. Edit android/app/build.gradle:
dependencies {
    ...
    compile "com.facebook.react:react-native:+"  // From node_modules
+   compile project(':react-native-paypal-integration')
}
  1. Edit android/settings.gradle:
...
include ':app'
+ include ':react-native-paypal-integration'
+ project(':react-native-paypal-integration').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-paypal-integration/android')
  1. Edit MainApplication.java:
+ import com.hieudole.paypal.PayPalPackage;
 
  public class MainApplication extends Application implements ReactApplication {
    //......
    
    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
+         new PayPalPackage(),
          new MainReactPackage()
      );
    }
    
    ......
  }

Usage

Import

import PayPal from 'react-native-paypal-integration';

Profile Sharing

PayPal.profileSharing({
    clientId: 'Your client ID',
    environment: PayPal.SANDBOX,
    merchantName: 'Your merchant name',
    merchantPrivacyPolicyUri: 'http://your-url.com/policy',
    merchantUserAgreementUri: 'http://your-url.com/legal',
    scopes: [
        PayPal.SCOPE_PROFILE, // Full Name, Birth Date, Time Zone, Locale, Language
        PayPal.SCOPE_PAYPAL_ATTRIBUTES, // Age Range, Account Status, Account Type, Account Creation Date
        PayPal.SCOPE_EMAIL, // Email
        PayPal.SCOPE_ADDRESS, // Address
        PayPal.SCOPE_PHONE // Telephone
    ]
  }, 
  function (r) {
    console.log(r);
  }
);

Package Sidebar

Install

npm i react-native-paypal-integration

Weekly Downloads

2

Version

1.1.1

License

MIT

Last publish

Collaborators

  • hieudole