简体   繁体   English

更新条纹付款金额

[英]Update Stripe Payment Amount

I'm attempting to have two stripe payment amounts on a one page application. 我正在尝试在一页应用程序上使用两个条带付款金额。 The user has 5 minutes to purchase the item at a sale price. 用户有5分钟的时间以促销价购买商品。 I then need to be able to update the price to a different amount. 然后,我需要能够将价格更新为其他金额。 I tried to simply create two stripe forms but you're not able to have more than one on a page per my understanding. 我试图简单地创建两个条纹形式,但据我所知,您在页面上不能有多个。 How would I go about doing this? 我将如何去做呢?

My stripe set-up: 我的条纹设置:

var token = req.body.stripeToken; // Using Express
var charge = stripe.charges.create({
  amount: 749,
  currency: "usd",
  description: "Example charge",
  source: token,

How would I change the "amount?" 我将如何更改“金额”?

If you had a <input type="hidden" name="chosen_amount" id="chosen_amount" /> 如果您有<input type="hidden" name="chosen_amount" id="chosen_amount" />

And use Javascript to change the value of the hidden field on click of the button then you can access the amount on the backend with var amount = req.body.chose_amount; 然后单击按钮,使用Javascript更改隐藏字段的值,然后可以使用var amount = req.body.chose_amount;来访问后端的var amount = req.body.chose_amount;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM