All Projects → stripe-samples → Nextjs Typescript React Stripe Js

stripe-samples / Nextjs Typescript React Stripe Js

Licence: mit
Full-stack TypeScript example using Next.js, react-stripe-js, and stripe-node.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Nextjs Typescript React Stripe Js

Sample Stripe Handler
Serverless function that uses the stripe api for a checkout process in a Vue application
Stars: ✭ 155 (-7.74%)
Mutual labels:  stripe-checkout
Ember Cli Stripe
Stripe checkout for Ember
Stars: ✭ 84 (-50%)
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 (-55.36%)
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 (+594.05%)
Mutual labels:  stripe-checkout
Ecommerce Netlify
🛍 A JAMstack Ecommerce Site built with Nuxt and Netlify Functions
Stars: ✭ 1,147 (+582.74%)
Mutual labels:  stripe-checkout
Checkout Netlify Serverless
Sell products on the Jamstack with Netlify Functions and Stripe Checkout!
Stars: ✭ 58 (-65.48%)
Mutual labels:  stripe-checkout
Unicorn Mart
A proof of concept e-commerce store leveraging Contentful, GatsbyJS, Stripe, and serverless via clay.run
Stars: ✭ 21 (-87.5%)
Mutual labels:  stripe-checkout
React Stripe Checkout
Load stripe's checkout.js as a react component. Easiest way to use checkout with React.
Stars: ✭ 930 (+453.57%)
Mutual labels:  stripe-checkout
Vue Stripe
Stripe Checkout & Elements for Vue.js
Stars: ✭ 669 (+298.21%)
Mutual labels:  stripe-checkout
Checkout One Time Payments
Use Checkout to quickly collect one-time payments.
Stars: ✭ 417 (+148.21%)
Mutual labels:  stripe-checkout
Nextjs Subscription Payments
Clone, deploy, and fully customize a SaaS subscription application with Next.js.
Stars: ✭ 402 (+139.29%)
Mutual labels:  stripe-checkout
Serverless Shop
Building a Serverless E-Commerce App with AWS Lambda, Stripe and React 💰 🌐
Stars: ✭ 325 (+93.45%)
Mutual labels:  stripe-checkout
Checkout Single Subscription
Learn how to combine Checkout and Billing for fast subscription pages
Stars: ✭ 310 (+84.52%)
Mutual labels:  stripe-checkout
Node.js-Stripe-Shopping-Cart
Example integration of Stripe's Checkout API into a Node.js application
Stars: ✭ 93 (-44.64%)
Mutual labels:  stripe-checkout
netlify-lambda-function-example
An example Netlify Lambda function that processes payments with Stripe.
Stars: ✭ 93 (-44.64%)
Mutual labels:  stripe-checkout
react-elements-netlify-serverless
Digital Wallet payments with React Stripe Elements and Netlify Functions
Stars: ✭ 21 (-87.5%)
Mutual labels:  stripe-checkout
direct-stripe
Stripe payment button for WordPress websites
Stars: ✭ 12 (-92.86%)
Mutual labels:  stripe-checkout
connect-direct-charge-checkout
Accept a payment with direct charges and Checkout
Stars: ✭ 18 (-89.29%)
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 (+24.4%)
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 (+0.6%)
Mutual labels:  stripe-checkout

Sample using Next.js, TypeScript, and react-stripe-js 🔒💸

This is a full-stack TypeScript example using:

Demo

The demo is running in test mode -- use 4242424242424242 as a test card number with any CVC + future expiration date.

Use the 4000000000003220 test card number to trigger a 3D Secure challenge flow.

Read more about testing on Stripe at https://stripe.com/docs/testing.

Shopping Cart Checkout Demo A gif of the Shopping Cart Checkout payment page.
Checkout Donations Demo A gif of the Checkout payment page.
Elements Donations Demo A gif of the custom Elements checkout page.

Deploy your own

Once you have access to the environment variables you'll need from the Stripe Dashboard, deploy the example using Vercel:

Deploy to Vercel

Included functionality

How to use

Using create-next-app

Execute create-next-app with npm or Yarn to bootstrap the example:

npx create-next-app --example with-stripe-typescript with-stripe-typescript-app
# or
yarn create next-app --example with-stripe-typescript with-stripe-typescript-app

Download manually

Download the example:

curl https://codeload.github.com/vercel/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-stripe-typescript
cd with-stripe-typescript

Required configuration

Copy the .env.local.example file into a file named .env.local in the root directory of this project:

cp .env.local.example .env.local

You will need a Stripe account (register) to run this sample. Go to the Stripe developer dashboard to find your API keys and replace them in the .env.local file.

NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=<replace-with-your-publishable-key>
STRIPE_SECRET_KEY=<replace-with-your-secret-key>

Now install the dependencies and start the development server.

npm install
npm run dev
# or
yarn
yarn dev

Forward webhooks to your local dev server

First install the CLI and link your Stripe account.

Next, start the webhook forwarding:

stripe listen --forward-to localhost:3000/api/webhooks

The CLI will print a webhook secret key to the console. Set STRIPE_WEBHOOK_SECRET to this value in your .env.local file.

Setting up a live webhook endpoint

After deploying, copy the deployment URL with the webhook path (https://your-url.now.sh/api/webhooks) and create a live webhook endpoint in your Stripe dashboard.

Once created, you can click to reveal your webhook's signing secret. Copy the webhook secret (whsec_***) and add it as a new environment variable in your Vercel Dashboard:

  • Select your newly created project.
  • Navigate to the Settings tab.
  • In the general settings scroll to the "Environment Variables" section.

After adding an environment variable you will need to rebuild your project for it to become within your code. Within your project Dashboard, navigate to the "Deployments" tab, select the most recent deployment, click the overflow menu button (next to the "Visit" button) and select "Redeploy".

Deploy on Vercel

You can deploy this app to the cloud with Vercel (Documentation).

Deploy Your Local Project

To deploy your local project to Vercel, push it to GitHub/GitLab/Bitbucket and import to Vercel.

Important: When you import your project on Vercel, make sure to click on Environment Variables and set them to match your .env.local file.

Deploy from Our Template

Alternatively, you can deploy using our template by clicking on the Deploy button below.

Deploy to Vercel

Get support

If you found a bug or want to suggest a new [feature/use case/sample], please file an issue.

If you have questions, comments, or need help with code, we're here to help:

Sign up to stay updated with developer news.

Authors

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