Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY)
- const createCheckoutSession = async(plan) => {
- const session = await stripe.checkout.sessions.create({
- success_url: `http://localhost:3000/success`,
- cancel_url: `http://localhost:3000/fail`,
- payment_method_types: ['card'],
- line_items: [
- {price: plan, quantity: 1},
- ],
- mode: 'subscription',
- });
- return session;
- }
- module.exports = {
- createCheckoutSession
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement