【发布时间】:2020-04-24 05:59:26
【问题描述】:
我正在尝试将 Stripe 支付网关添加到我的项目中。如果客户付款成功,我想调用 API 函数“orderStatusUpdate”调用。任何人都可以帮助我。
loadStripe() {
if(!window.document.getElementById('stripe-script')) {
var s = window.document.createElement("script");
s.id = "stripe-script";
s.type = "text/javascript";
s.src = "https://checkout.stripe.com/checkout.js";
window.document.body.appendChild(s);
}
}
pay(amount) {
var handler = (<any>window).StripeCheckout.configure({
key: 'Publishable key',
locale: 'auto',
token: async function (token: any) {
console.log(token)
//IN HERE i try to put function ("this.orderStatusUpdate"), but it will give error.
}
});
this.orderStatusUpdate()
handler.open({
name: 'Project',
description: 'Online payment API',
amount: amount * 100,
currency : '$'
});
}
orderStatusUpdate() {
alert("Testing")
}
【问题讨论】:
-
Stripe Checkout 是远离您页面的重定向。有一些建议的方式来完成订单in the Stripe docs。
-
我想触发我的功能。 :(
标签: javascript angular stripe-payments angular7 payment-gateway