Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-paypal-android

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-paypal-android

React Native PayPal for Android

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

react-native-paypal-android

Getting started

$ npm install react-native-paypal-android --save

Mostly automatic installation

$ react-native link react-native-paypal-android

Manual installation

Android
  1. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add import com.thebylito.rnpaypal.RnPaypalPackage; to the imports at the top of the file
  • Add new RnPaypalPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-paypal-android'
    project(':react-native-paypal-android').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-paypal-android/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-paypal-android')
    

Usage

import React, { Component } from 'react';
import RNPaypal from 'react-native-paypal-android';
import { StyleSheet, View, Button } from 'react-native';

const client = {
  sandbox: 'YOUR_SANDBOX_KEY',
  production: 'YOUR_PRODUCTION_KEY',
}

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Button
          title="Comprar"
          onPress={async () => {
            try {
                await RNPaypal.config({
                  clientId: client.sandbox,
                  environment: RNPaypal.constants.env.SANDBOX
                })
              const pay = await RNPaypal.buy({
                value: 1.99,
                productName: 'Testanto 100',
                currency: 'BRL',
                mode: RNPaypal.constants.mode.PAYMENT_INTENT_SALE
              });
              console.log(pay);// SUCESSS
            } catch (e) {
              console.log(e);// NO MONEY :()
            }
          }}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  }
});

API

import RNPaypal from 'react-native-paypal-android';

// TODO: What to do with the module?
RNPaypal;

Keywords

FAQs

Package last updated on 21 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc