I want to try the invoicing API in vuejs. The code example I want to apply is
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
const stripe = require('stripe')(
'sk_test_51M6ZtzIWDjpHNQK1pihAHQGM9Hh7aGVggo7yICRvYNUPqmHA2nIB9OLU6UrVmnWU8Spzcl1ZkPdRZu6zYCSVO7fi008peIrX1g'
);
const customer = await stripe.customers.create({
email: '[email protected]',
payment_method: 'pm_card_visa',
invoice_settings: {default_payment_method: 'pm_card_visa'},
});
This does'nt work and I get the error
Require is not defined
How to change this piece of code ?
requireis long gone, we useimporton modern frontend apps. This example uses Nuxt but could give you some leads. Otherwise, you probably have some examples on the documentation regarding React, could use some of those. Maybe even got some Vue?