Skip to content

Instantly share code, notes, and snippets.

@samcorcos
Last active May 31, 2016 08:27
Show Gist options
  • Save samcorcos/4e05da94942c9ac517f22d2bc0c09197 to your computer and use it in GitHub Desktop.
Save samcorcos/4e05da94942c9ac517f22d2bc0c09197 to your computer and use it in GitHub Desktop.
adding stripe integration for charge
...
var stripeCharge = require('./stripeCharge.js')
...
app.post('/api/purchase', parseURLencoded, function(req, res) {
var auth = req.headers['authorization']
if (auth !== "false") {
var token = req.body.token
var amount = req.body.amount
stripeCharge.charge(token, amount)
res.status(201)
} else {
res.status(401).send("Unauthorized.")
}
})
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment