UNPKG

legendaryjs

Version:

LegendaryJS – The ultimate backend framework for speed, power, and simplicity.

18 lines (15 loc) 550 B
const Stripe = require('stripe'); const stripe = new Stripe(process.env.STRIPE_SECRET || 'sk_test_placeholder'); async function stripeHandler(action, details) { switch (action) { case 'create-payment': return await stripe.paymentIntents.create({ amount: details.amount, currency: details.currency || 'usd', metadata: details.metadata || {}, }); case 'refund': return await stripe.refunds.create({ payment_intent: details.paymentIntentId }); } } module.exports = stripeHandler;