简体   繁体   English

条纹结帐-提交付款时触发事件

[英]Stripe checkout - trigger event when payment submitted

How do you trigger a javascript event when a user submits a Stripe Checkout modal? 当用户提交Stripe Checkout模式时,如何触发javascript事件?

This was some help but it seems like it's talking about any close event (not just submission), and I'm only worried about submission. 是一些帮助,但似乎正在谈论任何关闭事件(不仅仅是提交),我只担心提交。 Also, it seems a bit old. 另外,它似乎有点旧了。

I used the Same , As Mathew mention it is getting a token. 我使用了Same,正如Mathew提到的那样,它正在获得令牌。

 onToken = (token) => {

        axios.post('/api/charge',
                {
                    token: token,
                    comapnyName: this.state.auth.companyName,
                    email: this.state.auth.email,
                }
            ).then(data=>{

when you use the token={this.token} it will trigger this method but keep in mind, at the back end you have to use 当您使用token = {this.token}时,它将触发此方法,但请记住,在后端,您必须使用

 stripe.charges.create({
                amount: 2000,
                currency: 'usd',
                card: token.id,

        }).then(

hope this will be helpful to someone 希望这对某人有帮助

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

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