Socket
Socket
Sign inDemoInstall

react-stripe-typescript-client

Package Overview
Dependencies
9
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-stripe-typescript-client

A small library for React / React Native which creates Stripe tokens using your Publishable API Key which can then safely be consumed by your backend


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
540 kB
Created
Weekly downloads
 

Readme

Source

React Stripe Typescript Client

A small library for React / React Native which creates Stripe tokens using your Publishable API Key which can then safely be consumed by your backend

Installation

$ npm i install react-stripe-typescript-client

or

$ yarn add react-stripe-typescript-client

Usage


import { createToken } from "react-stripe-typescript-client"

const res: TokenResponse = await createToken(
    'YOUR_PUBLISHABLE_STRIPE_TOKEN',
      {
        cvc: 245,
        exp_month: 12,
        exp_year: 24,
        number: 42424242424242,
      }
    );

The createToken function also accepts all other Stripe card parameters within the card object

The TokenResponse interface has the following format

interface TokenResponse {
  id: string;
  object: string;
  card: Card;
  client_ip: string;
  created: number;
  livemode: boolean;
  type: string;
  used: boolean;
  error: TokenErrorResponse;
}

Error handling

If an error is sent back by Stripe, it's made available in the error key inside of the TokenResponse interface

Keywords

FAQs

Last updated on 07 Dec 2020

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