Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

react-native-paypal-android

Package Overview
Dependencies
514
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.3

2

package.json
{
"name": "react-native-paypal-android",
"version": "0.0.2",
"version": "0.0.3",
"description": "React Native PayPal for Android",

@@ -5,0 +5,0 @@ "main": "index.js",

# 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.reactnativepagseguro.RNPaypalPackage;` to the imports at the top of the file
- Add `new RNPaypalPackage()` to the list returned by the `getPackages()` method
2. 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')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-paypal-android')
```
## Usage
```javascript
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
```javascript
import RNPaypal from 'react-native-paypal-android';
// TODO: What to do with the module?
RNPaypal;
```
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc