Socket
Socket
Sign inDemoInstall

react-native-stripe-api

Package Overview
Dependencies
789
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-stripe-api

A small React Native library for Stripe Rest API


Version published
Weekly downloads
892
Maintainers
1
Install size
14.3 kB
Created
Weekly downloads
 

Readme

Source

react-native-stripe-api (only to create token)

NPM version Downloads Circle CI

Little Stripe library for React-Native.

Installation

$ npm i react-native-stripe-api --save

or

$ yarn add react-native-stripe-api

Roadmap

  • include a payment form component
  • include react-native-awesome-card-io
  • a new server project to keep secret

Setup

Security issue (fixed since 0.1.0)

https://github.com/xcarpentier/react-native-stripe-api/issues/8

Stripe API

This lib need a Stripe API Key

const apiKey = '<your Stripe API Key>';
const client = new Stripe(apiKey);

// Create a Stripe token with new card infos
const token = await client.createToken('4242424242424242' , '09', '18', '111');

// Create a new customer and link your new card
// const customer = await client.createCustomer(token.id, 'customer@email.com', '<Your user ID>', 'John', 'Doe');

// Create charge, 1 USD
// const charge = await client.createCharge(1 * 100, customer.id, 'Payment example','USD');

Functions

NameReturn TypeArgumentsDescription
createTokenPromise
  • cardNumber: string
  • expMonth: string
  • expYear: string
  • cvc: string
Create a new token (equivalent of a new card)
createCustomerPromise
  • token: string
  • email: string
Create a new customer and add card (or token)
getCustomerPromisecustomerId: stringRetrieve customer by its id
createChargePromise
  • amount: number
  • customer: string
  • description: string
  • currency: string = 'eur'
Create a new charge
refundChargePromisechargeId: stringRefund a previous charge
addCardToCustomerPromise
  • token: string
  • customerId: string
    Add a new card to a customer
    destroyCardOfCustomerPromise
    • cardId: string
    • customerId: string
    Delete a card from a customer
    createSubscriptionPromise
    • customerId: string
    • plan: string
    Subscribes a customer to a subscription plan
    retrieveSubscriptionPromise
    • subscriptionId: string
    Retrieve the data of a subscription

    Platform support

    Contribution

    Questions

    Feel free to contact me or create an issue

    made with ♥

    Keywords

    FAQs

    Last updated on 30 Jun 2017

    Did you know?

    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

    Stay in touch

    Get open source security insights delivered straight into your inbox.


    • Terms
    • Privacy
    • Security

    Made with ⚡️ by Socket Inc