Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.post('/new_order', function (req, res) {
console.log('Entered new_order function ')
console.log(req.body)
var token_info = req.body
Stripe.initialize('sk_live_CDYuW7Nsp4dtyKXT7ifjZ47q')
Stripe.Customers.create({
source: token_info.id,
plan: token_info.plan_id,
email: token_info.email,
metadata: {
owner_cell: token_info.owner_cell
}
}, {
success: function (httpResponse) {
console.log('Subscription successfully performed')
res.send('Success')
},
error: function (httpResponse) {
console.log(JSON.stringify(httpResponse.body, null, 4))
res.send('Uh oh, something went wrong')
}