All Projects → azmenak → React Stripe Checkout

azmenak / React Stripe Checkout

Licence: mit
Load stripe's checkout.js as a react component. Easiest way to use checkout with React.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Stripe Checkout

Vue Stripe
Stripe Checkout & Elements for Vue.js
Stars: ✭ 669 (-28.06%)
Mutual labels:  stripe-checkout
Checkout One Time Payments
Use Checkout to quickly collect one-time payments.
Stars: ✭ 417 (-55.16%)
Mutual labels:  stripe-checkout
Nextjs Subscription Payments
Clone, deploy, and fully customize a SaaS subscription application with Next.js.
Stars: ✭ 402 (-56.77%)
Mutual labels:  stripe-checkout
Serverless Shop
Building a Serverless E-Commerce App with AWS Lambda, Stripe and React 💰 🌐
Stars: ✭ 325 (-65.05%)
Mutual labels:  stripe-checkout
Checkout Single Subscription
Learn how to combine Checkout and Billing for fast subscription pages
Stars: ✭ 310 (-66.67%)
Mutual labels:  stripe-checkout
Node.js-Stripe-Shopping-Cart
Example integration of Stripe's Checkout API into a Node.js application
Stars: ✭ 93 (-90%)
Mutual labels:  stripe-checkout
netlify-lambda-function-example
An example Netlify Lambda function that processes payments with Stripe.
Stars: ✭ 93 (-90%)
Mutual labels:  stripe-checkout
react-elements-netlify-serverless
Digital Wallet payments with React Stripe Elements and Netlify Functions
Stars: ✭ 21 (-97.74%)
Mutual labels:  stripe-checkout
direct-stripe
Stripe payment button for WordPress websites
Stars: ✭ 12 (-98.71%)
Mutual labels:  stripe-checkout
connect-direct-charge-checkout
Accept a payment with direct charges and Checkout
Stars: ✭ 18 (-98.06%)
Mutual labels:  stripe-checkout
React Express Stripe
💰 Minimal Boilerplate for Stripe used in React and Express. Charge payments from your customers with this project.
Stars: ✭ 209 (-77.53%)
Mutual labels:  stripe-checkout
Checkout Subscription And Add On
Uses Stripe Checkout to create a payment page that starts a subscription for a new customer.
Stars: ✭ 169 (-81.83%)
Mutual labels:  stripe-checkout
Nextjs Typescript React Stripe Js
Full-stack TypeScript example using Next.js, react-stripe-js, and stripe-node.
Stars: ✭ 168 (-81.94%)
Mutual labels:  stripe-checkout
Sample Stripe Handler
Serverless function that uses the stripe api for a checkout process in a Vue application
Stars: ✭ 155 (-83.33%)
Mutual labels:  stripe-checkout
Ember Cli Stripe
Stripe checkout for Ember
Stars: ✭ 84 (-90.97%)
Mutual labels:  stripe-checkout
Github Pages Stripe Checkout
Example of a client-only (no server) donation payment page that can be hosted on GitHub using Stripe Checkout.
Stars: ✭ 75 (-91.94%)
Mutual labels:  stripe-checkout
Sample Vue Shop
See readme for newer repo details! A sample shop that shows how to manage payments with Vue, Stripe, and Serverless Functions
Stars: ✭ 1,166 (+25.38%)
Mutual labels:  stripe-checkout
Ecommerce Netlify
🛍 A JAMstack Ecommerce Site built with Nuxt and Netlify Functions
Stars: ✭ 1,147 (+23.33%)
Mutual labels:  stripe-checkout
Checkout Netlify Serverless
Sell products on the Jamstack with Netlify Functions and Stripe Checkout!
Stars: ✭ 58 (-93.76%)
Mutual labels:  stripe-checkout
Unicorn Mart
A proof of concept e-commerce store leveraging Contentful, GatsbyJS, Stripe, and serverless via clay.run
Stars: ✭ 21 (-97.74%)
Mutual labels:  stripe-checkout

npm version Dependencies Status Gitter

React Stripe Checkout Component

Stripe's Checkout makes it almost too easy to take people's money. This should make it even easier if you're building a react application.

Installation

Get started by installing with npm

npm install react-stripe-checkout

Requires babel for compiling. If anyone is having issues with that, open an issue and I'll do my best to better document the build process.

Changes in version 2.0

There used to be a separate .styl file and respective .css output. These have been removed and are now written directly in js.

Requirements

token and stripeKey are the only required props, everything else is optional as per the stripe docs. See Checkout Docs. All props go through simple validation and are passed to stripe checkout, they're also documented in StripeCheckout.js.

import React from 'react'
import StripeCheckout from 'react-stripe-checkout';

export default class TakeMoney extends React.Component {
  onToken = (token) => {
    fetch('/save-stripe-token', {
      method: 'POST',
      body: JSON.stringify(token),
    }).then(response => {
      response.json().then(data => {
        alert(`We are in business, ${data.email}`);
      });
    });
  }

  // ...

  render() {
    return (
      // ...
      <StripeCheckout
        token={this.onToken}
        stripeKey="my_PUBLISHABLE_stripekey"
      />
    )
  }
}

This will give you a default Stripe-style button which looks like this:

stripe checkout button

Send all the props!

<StripeCheckout
  name="Three Comma Co." // the pop-in header title
  description="Big Data Stuff" // the pop-in header subtitle
  image="https://stripe.com/img/documentation/checkout/marketplace.png" // the pop-in header image (default none)
  ComponentClass="div"
  label="Buy the Thing" // text inside the Stripe button
  panelLabel="Give Money" // prepended to the amount in the bottom pay button
  amount={1000000} // cents
  currency="USD"
  stripeKey="..."
  locale="zh"
  email="[email protected]"
  // Note: Enabling either address option will give the user the ability to
  // fill out both. Addresses are sent as a second parameter in the token callback.
  shippingAddress
  billingAddress={false}
  // Note: enabling both zipCode checks and billing or shipping address will
  // cause zipCheck to be pulled from billing address (set to shipping if none provided).
  zipCode={false}
  alipay // accept Alipay (default false)
  bitcoin // accept Bitcoins (default false)
  allowRememberMe // "Remember Me" option (default true)
  token={this.onToken} // submit callback
  opened={this.onOpened} // called when the checkout popin is opened (no IE6/7)
  closed={this.onClosed} // called when the checkout popin is closed (no IE6/7)
  // Note: `reconfigureOnUpdate` should be set to true IFF, for some reason
  // you are using multiple stripe keys
  reconfigureOnUpdate={false}
  // Note: you can change the event to `onTouchTap`, `onClick`, `onTouchStart`
  // useful if you're using React-Tap-Event-Plugin
  triggerEvent="onTouchTap"
  >
  <button className="btn btn-primary">
    Use your own child component, which gets wrapped in whatever
    component you pass into as "ComponentClass" (defaults to span)
  </button>
</StripeCheckout>

Other info

This was probably terribly written, I'll look at any PR coming my way.

Resources

Contributors

  • @orhan-swe added updates to checkout after instantiation and fixed a loading error
  • @ekalvi added multiple checkout buttons per page
  • @jstaffans adding support for locale
  • @gabestein added billing and shipping options
  • @samcorcos added testing
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].