【问题标题】:How to add payment form fields in stripe, angular5如何在条中添加付款表单字段,angular5
【发布时间】:2018-09-03 08:52:03
【问题描述】:

我有一张付款表格,里面只有卡号、cvc、有效期和邮编。 我想添加帐单名称、帐单地址等字段。因此客户可以添加更多信息。

我该如何解决这个问题?

ngAfterViewInit() {
    this.card = this.pmt.elements.create('card');
    this.card.mount(this.cardElement.nativeElement);
}

我尝试过这样的事情......不是这样,因为它不起作用。

 ngAfterViewInit() {
    this.card = this.pmt.elements.create('card', {
      billing_name: true
    });
   this.card.mount(this.cardElement.nativeElement);
}

【问题讨论】:

  • 您在 ngAfterViewInit 的第 2 行引用的 this.cardElement 是什么?你能发布整个组件文件(ts和html)吗?
  • 它是html中的一个元素..<div id="card-element" #cardElement></div>
  • 您是否使用@ViewChild() 来获取对#cardElement 的引用?
  • 是的,我做到了。``` @ViewChild('cardElement') cardElement: ElementRef;```

标签: angular stripe-payments


【解决方案1】:

这对我很有帮助。

您应该关注Stripe Elements 文档和它的存储库,用于在条带支付中添加额外的表单字段。

【讨论】:

    猜你喜欢
    • 2020-06-19
    • 2014-10-30
    • 2021-12-09
    • 2022-12-05
    • 2017-02-07
    • 2014-08-17
    • 2017-10-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多