// Require the Stripe library with a test secret key.
const stripe = require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2');
// Create a monthly plan.
const plan = await stripe.plans.create({
amount: 999,
currency: 'usd',
interval: 'month',
product: {
name: 'Gold Full',
},
});
// Subscribe the customer to the plan while applying a coupon.
const subscription = await stripe.subscriptions.create({
customer: customer.id,
plan: plan.id,
coupon: '25OFF',
});