私はストライプを使用して自分のウェブサイトで支払いを受け入れる方法を作成しようとしていますが、私のカタログのワットオブジェクトに応じて価格を変更します。私のショーページはオブジェクトとしてmongoからデータを取得します。オブジェクト内には異なるフィールドがあり、オブジェクト内にはフィールドがあります。strip.charges.create({});異なるオブジェクトを使用して価格を検索する変更額
app.post('/charge', function(req, res) {
var stripeToken = req.body.stripeToken;
//console.log("print the price "+req.data.price);
console.log("print the price "+data.price2);
console.log("print the price "+req.params.price);
console.log("print the price "+req.params.amount);
console.log("print the price "+req.body(JSON.stringify(data)));
//console.log("print the price "+JSON.stringify(req.data.price));
var amount = 1122;<= i want to make this change depending on wat item i load into the show page is there a function call like anything similiar to what i have tried above on my console.logs
stripe.charges.create({
card: stripeToken,
currency: 'usd',
amount: amount
},
function(err, charge) {
if (err) {
res.send(500, err);
} else {
res.send(204);
}
});
});
今私の量が静的であるとにかかわらず、私は私のカタログにクリックしたどのような項目にitllは常に11.22の代わりに必要な価格を請求:SOこれは私がストライプのドキュメントからそれを得たように私の充電ページが見えワットであります充電される。これを実装する方法はありますか?
トークンがそこからストライプに送られた金額と一致するようにクライアント側を把握する必要があります – charlietfl