app.post("/charge", (req, res) => { try { stripe.customers .create({ name: req.body.name, email: req.body.email, source: req.body.stripeToken }) .then(customer => stripe.charges.create({ amount: 199, currency: "usd", customer: customer.id }) ) .then(() => res.render("completed.html")) .then(() => key.addKey(req.body.name, req.body.email) .catch(console.error) ) .catch(err => console.log(err)); } catch (err) { res.send(err); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter