0
因此,这里是我的代码:条纹除以100的NodeJS
PaymentDaemon.authorize = function(req, callback) {
console.log("on est dans authorize");
console.log(req.amount);
stripe.charges.create({
amount: 3,//req.amount,
currency: req.currency,
source: req.card,
description: req.details,
capture: false
}, function(err, charge) {
if (err != null)
console.error("ERROR in PaymentDaemon.authorize: " + err);
else {
req.paidDate = null;
req.way = cfg.payment.way.in;
req.stripe = charge.id;
var search = {};
if (req.payment != null)
search._id = req.payment;
Payment.update(search, req, { upsert: true }, function(error) {
if (error != null) {
console.error("ERROR in PaymentDaemon.authorize: " + err);
console.error("ERROR Data not inserted in DB: " + JSON.stringify(req));
}
});
}
callback(err, charge);
});
}
我已经把3,因为该功能在其他地方打了个电话,我试图找到哪儿来的错误。
这里是callling代码:
var req = {
amount: amount,
currency: currency,
card: idcard,
details: null, // fixme
};
console.log("on est dans charge");
PaymentDaemon.authorize(req, function(error, charge) {
if (error != null)
{
console.error('ERROR PaymentDaemon.createPayment() (4): ' + error);
}
else
{
console.log(charge);
res.status(200).send(charge);
}
});
,当我打电话吧,我有这样的错误:
ERROR in PaymentDaemon.authorize: Error: Amount must convert to at least 50 cents. €0.03 converts to approximately $0.03.
ERROR PaymentDaemon.createPayment() (4): Error: Amount must convert to at least 50 cents. €0.03 converts to approximately $0.03.
所以条纹似乎除以100我的量,任何想法,为什么?
感谢和问候。
非常感谢和抱歉。 – user462794