创建一个表格以接受带条纹的信用卡

问题描述 投票:1回答:1

[我试图了解如何使用诸如信用卡号,有效期,信用卡,姓名和邮政编码之类的信息来制作表格,获取所有这些信息并触发付款。

我不想使用条纹集成。所以我在条纹上找到了此页面:https://stripe.com/docs/payments/accept-a-payment在此页面中,我们可以学习如何创建带有DIV卡元素的Stripe生成的表单:

<form id="payment-form">
  <div id="card-element">
    <!-- Elements will create input elements here -->
  </div>

  <!-- We'll put the error messages in this element -->
  <div id="card-errors" role="alert"></div>

  <button id="submit">Pay</button>
</form>

在文档中,我们可以看到由Stripe制作的示例:https://stripe.dev/elements-examples/我使用示例2示例2显示了一个“浮动标签”表单,该表单使用具有自定义Web字体的单个cardNumber,cardExpiry和cardCvc元素。

我们可以获取js文件和css文件,以及此处的通用代码:https://github.com/stripe/elements-examples/blob/master/js/index.js

但是我不明白,在sample2中,通用代码使用stripe.createToken,在文档中,他们使用confirmCardPayment

stripe.confirmCardPayment(clientSecret, {
    payment_method: {
      card: card,
      billing_details: {
        name: 'Jenny Rosen'
      }
    }
  }).then(function(result) {
    if (result.error) {
      // Show error to your customer (e.g., insufficient funds)
      console.log(result.error.message);
    } else {
      // The payment has been processed!
      if (result.paymentIntent.status === 'succeeded') {
        // Show a success message to your customer
        // There's a risk of the customer closing the window before callback
        // execution. Set up a webhook or plugin to listen for the
        // payment_intent.succeeded event that handles any business critical
        // post-payment actions.
      }
    }

我不知道如何获取我的信息(价格,邮政编码,信用卡号,有效期,信用卡)并触发付款。我迷路了。

请帮助,谢谢。

javascript php stripe-payments
1个回答
0
投票

由于Stripe需要满足新的数据保护法规的要求,因此您将不再能够检索表单数据。而是将数据直接发送到Stripe,您会收到代表该数据的秘密客户端令牌。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.