我只是試圖向Stripe發送數據來處理客戶。但是請求沒有定義?這怎麼可能?未在Nodejs應用程序中定義的請求
錯誤:
13:52:17 web.1 | /Users/admin/herokutest/app/routes.js:139
13:52:17 web.1 | var stripeToken = req.body.stripeToken;
13:52:17 web.1 |的ReferenceError:REQ沒有定義
App.js文件:
var stripeToken = req.body.stripeToken;
function subscribeUser(token, res){
stripe.customers.create({
card: stripeToken,
plan: 'standard',
email: '[email protected]'
}, function(err, customer) {
if (err) {
res.send({ok: false, message: 'Uh oh. there was a problem processing your card (error: ' + JSON.stringify(err) + ')'});
} else {
res.send({ok: true, message: 'Perfect, you have been subscribed to a plan'}),
res.render('subscribe', { title: 'Congratulations!' })
}
});
}
app.post('/getstarted3', function (req, res) {
subscribeUser();
res.render('subscribe', { title: 'Welcome' }); // load the index.jade file
});