Advertisement
Guest User

app

a guest
Mar 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. app.post("/charge", async (req, res) => {
  2. const { token } = req.body;
  3. const { currency, amount, description, receipt_email } = req.body.charge;
  4. try {
  5. const charge = await stripe.charges.create({
  6. source: token.id,
  7. amount,
  8. currency,
  9. description,
  10. receipt_email
  11. });
  12. res.json(charge);
  13. } catch (err) {
  14. res.status(500).json({ error: err });
  15. }
  16. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement