条纹结帐,付款后获取数据

时间:2021-06-20 08:16:23

标签: javascript angular stripe-payments stripe-checkout stripe-subscriptions

我有一个分条结账,可将用户重定向到他们这边的默认分条结账页面,付款完成后,它会重定向到我的网站页面。问题是我需要从付款中获取一些数据,但我阅读了文档,但不知道如何接收这些数据。

我知道我必须放置在条带结帐创建代码中,但我需要某种功能来接收我传递的数据。


 const stripe = await this.stripePromise;
 const { error } = await stripe.redirectToCheckout({

     mode: 'subscription',

     lineItems: [{ price: this.priceId, quantity: this.quantity }],

     clientReferenceId: this.userEmail,
     billingAddressCollection: this.userAdress,


     successUrl: `page`,
     cancelUrl: `page`,

   }); 

我正在传递 clientReferenceId 和 billingAddressCollection,但是如何在成功页面上收到它?

我需要一些条纹功能吗?

1 个答案:

答案 0 :(得分:0)

侦听网络钩子事件,例如 payment_intent.succeeded。由于您使用的是 Checkout,因此请收听 checkout.session.completed 事件。