程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Stripe JS Angular,无法在 paymentRequest.on("paymentMethod") 中调用方法大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决Stripe JS Angular,无法在 paymentrequest.on("paymentMethod") 中调用方法?

开发过程中遇到Stripe JS Angular,无法在 paymentrequest.on("paymentMethod") 中调用方法的问题如何解决?下面主要结合日常开发的经验,给出你关于Stripe JS Angular,无法在 paymentrequest.on("paymentMethod") 中调用方法的解决方法建议,希望对你解决Stripe JS Angular,无法在 paymentrequest.on("paymentMethod") 中调用方法有所启发或帮助;

我想在我的 Angular 应用程序中使用 Stripe 处理付款。为此,我创建了此方法:

 paymentrequest.on('paymentmethod',function (ev) {
    console.log(ev.paymentMethod.ID);
    const clIEnSecret = dataset.secret
    Stripe.confirmCardPayment(
      clIEnSecret,{payment_method: ev.paymentMethod.ID},{handleActions: falsE}
    ).then(function (confirmResult) {
      if (confirmResult.error) {
        // Report to the browser that the payment Failed,prompTing it to
        // re-show the payment interface,or show an error message and close
        // the payment interface.
        alert('transaktion fehlgeschlagen');
        ev.complete('fail');
      } else {
        // Report to the browser that the confirmation was successful,prompTing
        // it to close the browser payment method collection interface.
        ev.complete('success');

        // check if the PaymenTintent requires any actions and if so let Stripe.Js
        // handle the flow. If using an API version older than "2019-02-11" instead
        // instead check for: `paymenTintent.status === "requires_source_action"`.
        if (confirmResult.paymenTintent.status === 'requires_action') {
          // Let Stripe.Js handle the rest of the payment flow.
          Stripe.confirmCardPayment(clIEnSecret).then(function (result) {
            if (result.error) {
              alert('Bezahlung fehlgeschlagen')
              // The payment Failed -- ask your customer for a new payment method.
            } else {
              // The payment has succeeded.
              this.completePaymenTinorder();
              console.log('payment succeeeded');
            }
          });
        } else {
          this.completePaymenTinorder();
          console.log('payment succeeded');
        }
      }
    });
  });

不幸的是我不能调用方法 completePaymenTinorder();

我收到错误无法读取未定义的属性“completePaymenTinorder”。

这就是我创建方法的方式:

  completePaymenTinorder() {
const url = `https://myurl/delivery/payment/approved?orderID=${this.orderID}`;
this.http.get<any>(url,{
  headers: {token: this.APIKey},}).subscribe(async dataset => {
  // Todo perform Deeplink
},err => {
  alert('Status konnte nicht aktualisIErt werden,bitte Support kontaktIEren.');
});

}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

大佬总结

以上是大佬教程为你收集整理的Stripe JS Angular,无法在 paymentRequest.on("paymentMethod") 中调用方法全部内容,希望文章能够帮你解决Stripe JS Angular,无法在 paymentRequest.on("paymentMethod") 中调用方法所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。