Last active
May 31, 2016 08:27
-
-
Save samcorcos/4e05da94942c9ac517f22d2bc0c09197 to your computer and use it in GitHub Desktop.
adding stripe integration for charge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
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