npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-stripe-payments

v1.1.0

Published

Lightweight, easy to integrate and use React native library for Stripe payments (using Payment Intents) compliant with SCA (strong customer authentication).

Downloads

94

Readme

Important!

We highly recommend using official Stripe react native library. This library was created prior to the introduction of the official one and is currently not developed further. It's maintained to support current users but they're also encouraged to migrate to using the official library.

React Native Stripe payments

A well typed React Native library providing support for Stripe payments on both iOS and Android.

React Native Stripe payments

Getting started

Starting September 14, 2019 new payments regulation is being rolled out in Europe, which mandates Strong Customer Authentication (SCA) for many online payments in the European Economic Area (EEA). SCA is part of the second Payment Services Directive (PSD2).

This library provides simple way to integrate SCA compliant Stripe payments into your react native app with a first class Typescript support.

Installation

$ yarn add react-native-stripe-payments

$ npx react-native link react-native-stripe-payments

The library ships with platform native code that needs to be compiled together with React Native. This requires you to configure your build tools which can be done with autolinking.

Additional iOS setup

As Stripe SDK is now in Swift, the following changes must be done or the compilation will fail.

  1. Create a "Dummy" swift file (xcode -> open your project -> right click on the folder named after your project, where Info.plist resides -> new File -> Swift -> say YES when asked for the bridging header)
  2. Remove the swift-5.0 search path, or you will get an error about undefined symbols. Take a look here -> https://github.com/react-native-community/upgrade-support/issues/62#issuecomment-622985723

Usage

Setup

First of all you have to obtain Stripe account publishabe key. And then you need to set it for module.

import stripe from 'react-native-stripe-payments';

stripe.setOptions({ publishingKey: 'STRIPE_PUBLISHING_KEY' });

Validate the given card details

import stripe from 'react-native-stripe-payments';

const isCardValid = stripe.isCardValid({
  number: '4242424242424242',
  expMonth: 10,
  expYear: 21,
  cvc: '888',
});

One-time payments

import stripe from 'react-native-stripe-payments';

const cardDetails = {
  number: '4242424242424242',
  expMonth: 10,
  expYear: 21,
  cvc: '888',
}
stripe.confirmPayment('client_secret_from_backend', cardDetails)
  .then(result => {
    // result of type PaymentResult
  })
  .catch(err =>
    // error performing payment
  )

Reusing cards

Not supported yet, though as we're highly invested in development of our product which depends on this library we'll do it as soon as possible!

Development and contribution

Demo app

Unfortunately currently broken.

Demo server

To start local web server which mocks server side behaviour execute yarn server from demo directory.