All Projects → ynnoj → Next Stripe

ynnoj / Next Stripe

Licence: mit
Simplified server-side Stripe workflows in Next.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Next Stripe

Builderbook
Open source web application to learn JS stack: React, Material-UI, Next.js, Node.js, Express.js, Mongoose, MongoDB database.
Stars: ✭ 3,015 (+528.13%)
Mutual labels:  stripe, nextjs
Stripe Demo Connect Roastery Saas Platform
Roastery demo SaaS platform using Stripe Connect
Stars: ✭ 33 (-93.12%)
Mutual labels:  stripe, nextjs
Mdx Docs
📝 Document and develop React components with MDX and Next.js
Stars: ✭ 412 (-14.17%)
Mutual labels:  nextjs
Ts Monorepo
Template for setting up a TypeScript monorepo
Stars: ✭ 459 (-4.37%)
Mutual labels:  nextjs
Hackernews React Graphql
Hacker News clone rewritten with universal JavaScript, using React and GraphQL.
Stars: ✭ 4,242 (+783.75%)
Mutual labels:  nextjs
Next Apollo Example
Next & Apollo Example
Stars: ✭ 413 (-13.96%)
Mutual labels:  nextjs
Opencollective Frontend
Open Collective Frontend. A React app powered by Next.js.
Stars: ✭ 446 (-7.08%)
Mutual labels:  nextjs
Stackoverflow Clone
This project is a simplified a full stack clone of Stackoverflow.
Stars: ✭ 395 (-17.71%)
Mutual labels:  nextjs
Firebase Gcp Examples
🔥 Firebase app architectures, languages, tools & some GCP things! React w Next.js, Svelte w Sapper, Cloud Functions, Cloud Run.
Stars: ✭ 470 (-2.08%)
Mutual labels:  nextjs
Next Sitemap
Sitemap generator for next.js. Generate sitemap(s) and robots.txt for all static/pre-rendered/dynamic/server-side pages.
Stars: ✭ 426 (-11.25%)
Mutual labels:  nextjs
Next Connect
The TypeScript-ready, minimal router and middleware layer for Next.js, Micro, Vercel, or Node.js http/http2
Stars: ✭ 454 (-5.42%)
Mutual labels:  nextjs
Nextjs Page Transitions
Travel App, Native-like Page Transitions (:atom: with React & Next.js)
Stars: ✭ 424 (-11.67%)
Mutual labels:  nextjs
Checkout One Time Payments
Use Checkout to quickly collect one-time payments.
Stars: ✭ 417 (-13.12%)
Mutual labels:  stripe
Trends
ultra high performance github trending application
Stars: ✭ 450 (-6.25%)
Mutual labels:  nextjs
Flasksaas
A great starting point to build your SaaS in Flask & Python, with Stripe subscription billing 🚀
Stars: ✭ 412 (-14.17%)
Mutual labels:  stripe
Next Compose Plugins
💡next-compose-plugins provides a cleaner API for enabling and configuring plugins for next.js
Stars: ✭ 465 (-3.12%)
Mutual labels:  nextjs
Gringotts
A complete payment library for Elixir and Phoenix Framework
Stars: ✭ 396 (-17.5%)
Mutual labels:  stripe
Stripe Connect Rocketrides
Sample on-demand platform built on Stripe: Connect onboarding for pilots, iOS app for passengers to request rides.
Stars: ✭ 426 (-11.25%)
Mutual labels:  stripe
Next Server Components
Experimental demo of React Server Components with Next.js. Deployed serverlessly on Vercel.
Stars: ✭ 444 (-7.5%)
Mutual labels:  nextjs
Example Storefront
Example Storefront is Reaction Commerce’s headless ecommerce storefront - Next.js, GraphQL, React. Built using Apollo Client and the commerce-focused React UI components provided in the Storefront Component Library (reactioncommerce/reaction-component-library). It connects with Reaction backend with the GraphQL API.
Stars: ✭ 471 (-1.87%)
Mutual labels:  nextjs

NextStripe

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 [email protected]

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

Stripe API Docs

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

Stripe API Docs

import { createPaymentIntent } from 'next-stripe/client'

const paymentIntent = await createPaymentIntent({
  amount: 1000,
  currency: 'usd'
})

Confirm

Stripe API Docs

import { confirmPaymentIntent } from 'next-stripe/client'

const paymentIntent = await confirmPaymentIntent('pi_id', {
  payment_method: 'pm_id'
})

Retrieve

Stripe API Docs

import { retrievePaymentIntent } from 'next-stripe/client'

const paymentIntent = await retrievePaymentIntent('pi_id')

Update

Stripe API Docs

import { updatePaymentIntent } from 'next-stripe/client'

const paymentIntent = await updatePaymentIntent('pi_id', {
  amount: 1000,
  currency: 'usd'
})

Billing Portal Sessions

Create

Stripe API Docs

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