Registry / payments / react-native-stripe-api

react-native-stripe-api

JSON →
library0.1.0jsnpmunverified

A small React Native library that provides a client for the Stripe REST API, primarily focused on creating tokens from card details. Version 0.1.0 is the latest and only stable release. It is a lightweight alternative to the official Stripe SDK for React Native, but note that many advertised methods (createCustomer, createCharge, etc.) are marked as deprecated in the README and may not work reliably. The library has a fixed security issue (issue #8) and has minimal maintenance. It requires React Native 0.27.2+ and has not been updated since 2016.

npm install react-native-stripe-api
INSTALL
IMPORT
SIG · REACT-NATIVE-STRIP
R
react-native-stripe-api
paymentsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Stripe
import Stripe from 'react-native-stripe-api'
const Stripe = require('react-native-stripe-api')
Default export class. The CJS require works but the package does not ship TypeScript types.
Stripe
const Stripe = require('react-native-stripe-api').default
const Stripe = require('react-native-stripe-api')
If using CommonJS with transpilation, the default export might be under .default. The package uses ES modules.
ReactNativeStripeApi
import { default as Stripe } from 'react-native-stripe-api'
import { ReactNativeStripeApi } from 'react-native-stripe-api'
Named export does not exist; only a default export named Stripe.

Imports Stripe, instantiates with API key, and creates a token from test card details.

import Stripe from 'react-native-stripe-api'; const apiKey = process.env.STRIPE_API_KEY ?? ''; const client = new Stripe(apiKey); async function createToken() { try { const token = await client.createToken('4242424242424242', '12', '25', '123'); console.log('Token created:', token); } catch (error) { console.error('Error:', error); } } createToken();
Debug
Known issues
breakingSecurity issue fixed in 0.1.0 - see GitHub issue #8. Older versions expose API keys or have other vulnerabilities.
fix
Update to version 0.1.0 or later.
affects: <0.1.0
deprecatedMethods like createCustomer, createCharge, refundCharge, addCardToCustomer, destroyCardOfCustomer, createSubscription, retrieveSubscription are deprecated and struck through in the README. They may not work as expected.
fix
Use only createToken. For other Stripe operations, use the official Stripe SDK or a backend proxy.
affects: >=0.0.0
gotchaRequires React Native 0.27.2+ and Android 4.4+ (API level 19). Older versions may not work.
fix
Ensure React Native version is >=0.27.2 and Android API level >=19.
affects: >=0.0.0
breakingThe package has outdated peer dependencies, including babel-polyfill@6.9.1 and react@15.1.0. It may conflict with newer React Native setups.
fix
Consider using the official Stripe SDK for React Native or a more modern alternative.
affects: >=0.0.0
deprecatedThe library is in maintenance mode with no updates since 2016. Many Stripe API changes (e.g., API version upgrades, new endpoints) are not supported.
fix
Migrate to the official Stripe SDK (@stripe/stripe-react-native) or a modern wrapper.
affects: >=0.0.0
breakingThe createToken method may not handle Stripe API errors correctly; it returns raw error objects without the typical Stripe Error structure.
fix
Wrap calls in try-catch and handle errors manually. For better error handling, use the official Stripe SDK.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'react-native-stripe-api'
Package not installed or missing node_modules.
fix
npm install react-native-stripe-api --save
TypeError: _reactNativeStripeApi2.default is not a constructor
Incorrect import when using CommonJS require without .default.
fix
const Stripe = require('react-native-stripe-api').default;
undefined is not an object (evaluating 'client.createToken')
Stripe instance created with invalid or missing API key.
fix
Provide a valid Stripe publishable key to the Stripe constructor.
Network request failed
Android emulator/device does not have internet or Stripe server is unreachable.
fix
Check network connectivity and ensure the API key is correct. On Android emulator, use 10.0.2.2 for localhost.
The Stripe API key format is invalid
Supplied API key does not start with 'pk_' or 'sk_'.
fix
Use a valid Stripe publishable key (starts with 'pk_test' or 'pk_live').
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
reactrequiredpeer dependency required for React Native
react-nativerequiredpeer dependency required to run on mobile
babel-polyfilloptionalold peer dependency for polyfilling ES6 features
Agent activity
31 hits · last 30 days
node
28
OpenAI (training)
1
Resources
react-native-stripe-api — npm install react-native-stripe-api · libregistry