All Projects → bamlab → react-native-stripe

bamlab / react-native-stripe

Licence: other
No description, website, or topics provided.

Programming Languages

objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language
ruby
36898 projects - #4 most used programming language

react-native-stripe

Basic Stripe integration with React Native.

The project just started, feel free to contribute.

Getting started

$ npm install react-native-stripe --save

Installation

iOS

  1. Settup cocoapod if not done yet.
  2. Add in your podfile, the following lines :
  pod 'react-native-stripe', path: '../../..'
  pod 'yoga', path: '../node_modules/react-native/ReactCommon/yoga/yoga.podspec'
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
    'DevSupport'
  ]
  1. Run pod install in your ios/ folder.

Android

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

Usage

import Stripe from 'react-native-stripe';

Stripe.init({
  publishableKey: 'pk_...',
});

Stripe.createTokenWithCard({
    number: '4111 1111 1111 1111',
    cvc: '123',
    expMonth: 11,
    expYear: 22,
}).then(res => {
  console.log(res.token);
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].