node v10.20.1
version: 1.0.0
const customer = await require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2').customers.create({ source: 'tok_visa', description: 'John Doe', email: 'john@example.com', });
// 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', });
Created from: https://stripe.com/

no comments

    sign in to comment