简体   繁体   English

带条纹元素的可变数量

[英]Variable amount with stripe elements

I would like to create a payment page using stripe elements, based on this example我想根据这个例子使用条纹元素创建一个支付页面

例子

As you can see, they use Stripe elements, and the customer form is on the same page.如您所见,他们使用 Stripe 元素,并且客户表单位于同一页面上。

Do you have any idea?你有什么主意吗?

You could follow an example like this , but when creating the payment intent replace the calculation of amount based on items to just be an amount sent from the client on the body :您可以按照这样的示例进行操作,但是在创建付款意图时,将基于项目的amount计算替换为客户端在body上发送的金额:

// Create a PaymentIntent with the order amount and currency
$payment_intent = \Stripe\PaymentIntent::create([
  "amount" => $body->amount_entered,
  "currency" => $body->currency
]);

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

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