Skip to content

Instantly share code, notes, and snippets.

@mtermoul
Created May 16, 2019 22:01
Show Gist options
  • Save mtermoul/4e2c5adef4236256c1f907af2d100932 to your computer and use it in GitHub Desktop.
Save mtermoul/4e2c5adef4236256c1f907af2d100932 to your computer and use it in GitHub Desktop.
crowd-pitch/public/js/Stripe.js
...
app.post('/pay', function(req, res) {
stripe.charges.create({
amount: Number(req.body.amount) * 100, // amount in cents
currency: 'usd',
description: `${req.body.firstName} ${req.body.lastName} (${req.body.email}) - ${req.body.orderSummary} - Source: ${req.body.pageSource}`,
source: req.body.stripeToken,
statement_descriptor: 'CROWD-PITHC GOOG CASHM'
})
.then(charge => {
res.send(charge);
})
.catch(error => {
console.log('--- Error:', error);
res.status(500).send(error);
});
});
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment