ynnoj/next-stripe
ynnoj/next-stripe has 559 GitHub stars and 17 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-12 01:43 UTC. Last push 2026-11-05.
Simplified server-side Stripe workflows in Next.js
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalNextStripe
Simplified server-side Stripe workflows in Next.js
⚠️ PLEASE NOTE: This library is currently in beta and should be used in production with caution!
Getting Started
yarn add next-stripe@beta
Add the API route
Create a [...nextstripe].js catch-all route in your project's pages/api/stripe directory.
⚠️ PLEASE NOTE: It is recommended you use a restricted key with limited API access with this library. These keys can be created and configured with the required access in the Stripe Dashboard.
import NextStripe from 'next-stripe'
export default NextStripe({
stripe_key: process.env.STRIPE_RESTRICTED_KEY
})
Usage
next-stripe/client exports helper functions to call the Next.js API routes.
Checkout Sessions
Create
import { createCheckoutSession } from 'next-stripe/client'
const session = await createCheckoutSession({
success_url: window.location.href,
cancel_url: window.location.href,
line_items: [{ price: 'price_id', quantity: 1 }],
payment_method_types: ['card'],
mode: 'payment'
})
PaymentIntents
Create
import { createPaymentIntent } from 'next-stripe/client'
const paymentIntent = await createPaymentIntent({
amount: 1000,
currency: 'usd'
})
Confirm
import { confirmPaymentIntent } from 'next-stripe/client'
const paymentIntent = await confirmPaymentIntent('pi_id', {
payment_method: 'pm_id'
})
Retrieve
import { retrievePaymentIntent } from 'next-stripe/client'
const paymentIntent = await retrievePaymentIntent('pi_id')
Update
import { updatePaymentIntent } from 'next-stripe/client'
const paymentIntent = await updatePaymentIntent('pi_id', {
amount: 1000,
currency: 'usd'
})
Billing Portal Sessions
Create
import { createBillingPortalSession } from 'next-stripe/client'
const session = await createBillingPortalSession({
customer: 'cus_id',
return_url: window.location.href
})
Acknowledgements
- A lot of the patterns in this library were inspired by NextAuth.
- Thanks to Jamie Barton for the initial idea.
Explore related projects
freeCodeCamp/freeCodeCamp
freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.
459,022 starsdonnemartin/system-design-primer
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
377,646 starsreact/react
The library for web and native user interfaces.
252,534 starsvuejs/vue
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
212,530 stars