Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.post("/charge", async (req, res) => {
- const { token } = req.body;
- const { currency, amount, description, receipt_email } = req.body.charge;
- try {
- const charge = await stripe.charges.create({
- source: token.id,
- amount,
- currency,
- description,
- receipt_email
- });
- res.json(charge);
- } catch (err) {
- res.status(500).json({ error: err });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement