All Projects → Agaweb → react-native-stripe

Agaweb / react-native-stripe

Licence: MIT license
Unofficial integration of the payment APIs from the Stripe SDK on react-native

Programming Languages

kotlin
9241 projects
swift
15916 projects
javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language
Starlark
911 projects

Projects that are alternatives of or similar to react-native-stripe

module-stripe
Stripe Payments for Magento 2
Stars: ✭ 45 (+114.29%)
Mutual labels:  stripe, stripe-payment
stripe-course
Stripe Payments In Practice - Build your own online ecommerce store and subscription membership website
Stars: ✭ 31 (+47.62%)
Mutual labels:  stripe, stripe-payments
Business-Stripe
Perl bindings for Stripe payment system
Stars: ✭ 21 (+0%)
Mutual labels:  stripe, stripe-payment
DwinaTech-Shop
E-commerce application. created for education and learning
Stars: ✭ 35 (+66.67%)
Mutual labels:  stripe, stripe-payments
Node.js-Stripe-Shopping-Cart
Example integration of Stripe's Checkout API into a Node.js application
Stars: ✭ 93 (+342.86%)
Mutual labels:  stripe, stripe-payments
TradeByte
💸 TradeByte - Stocks Trading Simulation WebApp
Stars: ✭ 30 (+42.86%)
Mutual labels:  stripe, stripe-payments
open-crowd-fund
🐣 Your open source solution to crowd fund your ideas. Powered by Gatsby.js.
Stars: ✭ 95 (+352.38%)
Mutual labels:  stripe
pinax-stripe-light
a payments Django app for Stripe
Stars: ✭ 670 (+3090.48%)
Mutual labels:  stripe
payment-fields
React component for Braintree/Stripe/Square payment fields
Stars: ✭ 17 (-19.05%)
Mutual labels:  stripe
dailycodingproblem
Solutions to Daily Coding Problem questions
Stars: ✭ 26 (+23.81%)
Mutual labels:  stripe
koa-better-error-handler
A better error-handler for Lad and Koa. Makes `ctx.throw` awesome (best used with koa-404-handler)
Stars: ✭ 51 (+142.86%)
Mutual labels:  stripe
proof-of-kyc
An NFT that proves you've gone through an identity verification process, powered by Stripe Identity.
Stars: ✭ 78 (+271.43%)
Mutual labels:  stripe
laravel-stripe
No description or website provided.
Stars: ✭ 14 (-33.33%)
Mutual labels:  stripe
saving-card-after-payment
Learn how to save a card for later reuse after making a payment
Stars: ✭ 78 (+271.43%)
Mutual labels:  stripe
Ignite
A comprehensive Flask boilerplate to build SaaS applications that includes Stripe billing, emails, login, and OAuth.
Stars: ✭ 102 (+385.71%)
Mutual labels:  stripe
charging-for-multiple-plan-subscriptions
Getting started with Stripe Elements and Stripe Billing to charge a customer for a monthly subscription with multiple items.
Stars: ✭ 54 (+157.14%)
Mutual labels:  stripe
react-elements-netlify-serverless
Digital Wallet payments with React Stripe Elements and Netlify Functions
Stars: ✭ 21 (+0%)
Mutual labels:  stripe
stripe-graphql
[WIP] 🚧🚧🚧 😎 Community-driven Stripe GraphQL API with superpowers.
Stars: ✭ 53 (+152.38%)
Mutual labels:  stripe
commercejs-chopchop-demo
A Commerce.js starter kit for Next.js. A beautifully designed elegantly developed, end to end commerce experience for developers and agencies. Pre-integrated with Stripe. One-click deploy to Vercel.
Stars: ✭ 129 (+514.29%)
Mutual labels:  stripe
teini
👶 Teini (tiny, [ˈtīnē]) is an extremely small webshop leveraging awesome and free solutions like Github and Vercel.
Stars: ✭ 148 (+604.76%)
Mutual labels:  stripe

React Native Stripe

Stripe payments for react-native

Warning

This library is really fresh, if you encounter a bug don't be afraid to report it

Requirements

This module uses the latest iOS Stripe SDK (dropped support for iOS 10) so the minimum platform is now iOS 11

Installation

npm install @agaweb/react-native-stripe
cd ios && pod install

Additional iOS setup

It must be done or the compilation will fail (the Stripe SDK is now in full Swift)

  1. Create the famous "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 (try it if you don't believe me), do this -> react-native-community/upgrade-support#62 (comment)

Tested with the latest Xcode, I spent a lot of hours finding the 2nd additional step, so if you have an outdated Xcode version or an outdated react-native version, please upgrade.

A note about the widget and the manual card validation

I'll be honest I couldn't manage to get the Android CardInputWidget working, the animation doesn't work (stripe/stripe-android#655), so I implemented the CardMultilineWidget instead.
It means that Android and iOS have different UI (on Android is more material design).
I could have used a third party credit card form like tipsi-stripe, but on the Stripe SDK the manual card validation is now deprecated so I'm not going to implement it.

Usage

Setup

You should call this method as early as possible (ex. at the first index.js), it must be called before everything else from this module

import stripe from "@agaweb/react-native-stripe";

stripe.initModule(YOUR_PUBLISHABLE_KEY)

Component: StripeCardInputWidget

Wrapper around the Android (CardMultilineWidget) and iOS (STPPaymentCardTextField) native card collection inputs (integrated with react-native TextInputState undocumented API, so Keyboard.dismiss() will work)

Basic usage

import {StripeCardInputWidget} from '@agaweb/react-native-stripe';

export const Test = () => {
    return (
        <StripeCardInputWidget
            onCardValidCallback={({isValid, cardParams}) => {
                console.log(isValid, cardParams);
        }} />
    );
};

Props

Name Description Details
onCardValidCallback Callback which returs {isValid, cardParams}
- isValid gives you the state of the card inserted
- cardParams contains the number, expMonth, expYear, cvc, brand and if enabled postalCode
function
enabled Enable or disable the inputs boolean
postalCodeEntryEnabled Enable or disable the visibility of the postal code input boolean
cardInputStyle
iOS only
Style applicable only to the ios component, support for:
- textColor
- placeholderColor
- borderColor
- borderWidth
- backgroundColor
object
numberPlaceholder Only iOS string
cvcPlaceholder Only iOS string
expirationPlaceholder Only iOS string
postalCodePlaceholder Only iOS string

Methods (from ref)

Use these only if really needed

Name Description
focus Makes the native component request focus
blur Makes the native component lose focus
clear Clear the native fields

Module API: confirmPaymentWithCard

Confirm using the card details you get from the widget or from anywhere else

import stripe from '@agaweb/react-native-stripe';

stripe
    .confirmPaymentWithCard(clientSecret, cardParams, savePaymentMethod?)
    .then(() => {
        console.log('Paid');
    })
    .catch((err) => {
        console.log(err);
    });
Name Description Required
clientSecret The client secret of the source. Used for client-side retrieval using a publishable key yes
cardParams Example:
{number: "4242424242424242", expMonth: 02, expYear: 22, cvc: "222"}
yes
savePaymentMethod Save the payment method to the attached customer (if present).
Used to store cards for future payments, especially helpful for confirmPaymentWithPaymentMethodId
no

Module API: confirmPaymentWithPaymentMethodId

Confirm using an already present paymentMethodId (ex. reuse cards)

import stripe from '@agaweb/react-native-stripe';

stripe
    .confirmPaymentWithPaymentMethodId(clientSecret, paymentMethodId)
    .then(() => {
        console.log('Paid');
    })
    .catch((err) => {
        console.log(err);
    });
Name Description Required
clientSecret The client secret of the source. Used for client-side retrieval using a publishable key yes
paymentMethodId The payment method attached to the customer, you can get a list of the available methods from the Stripe WS yes

Module API: confirmCardSetup

Confirm Setup Intent using the card details you get from the widget or from anywhere else
Both iOS and Android call this name confirmSetupIntent, but JS deprecated it, in favor of confirmCardSetup
Useful for attach cards to the customer without make a payment

import stripe from '@agaweb/react-native-stripe';

stripe
    .confirmCardSetup(clientSecret, cardParams)
    .then((data) => {
        console.log('Card Saved', data);
    })
    .catch((err) => {
        console.log(err);
    });
Name Description Required
clientSecret The client secret of the SetupIntent yes
cardParams Only cardParams for now, paymentMethodId is going to be supported a bit later yes
Result (key) Description
paymentMethodId Registered method id

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

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].