Skip to content

Instantly share code, notes, and snippets.

@uvinw
uvinw / setUpStripeSubscription.js
Created June 10, 2024 14:29 — forked from soulbliss/setUpStripeSubscription.js
Code to setup stripe subscriptions. Code credits to @marc_louvion
// app > api > webhook > stripe > js route.js -->
import { NextResponse } from 'next/server';
import { headers } from 'next/headers';
import Stripe from 'stripe';
import connectMongo from '@/libs/mongoose';
import User from '@models/User';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;