Advertisement
Dodo67

stripe.controller

Mar 14th, 2022
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY)
  2.  
  3. const createCheckoutSession = async(plan) => {
  4.   const session = await stripe.checkout.sessions.create({
  5.   success_url: `http://localhost:3000/success`,
  6.   cancel_url: `http://localhost:3000/fail`,
  7.   payment_method_types: ['card'],
  8.   line_items: [
  9.     {price: plan, quantity: 1},
  10.   ],
  11.   mode: 'subscription',
  12. });
  13. return session;
  14. }
  15.  
  16. module.exports = {
  17.   createCheckoutSession
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement