问题描述
我有一个分条结账,可将用户重定向到他们这边的默认分条结账页面,付款完成后,它会重定向到我的网站页面。问题是我需要从付款中获取一些数据,但我阅读了文档,但不知道如何接收这些数据。
我知道我必须放置在条带结帐创建代码中,但我需要某种功能来接收我传递的数据。
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,但是如何在成功页面上收到它?
我需要一些条纹功能吗?
解决方法
侦听网络钩子事件,例如 payment_intent.succeeded
。由于您使用的是 Checkout,因此请收听 checkout.session.completed
事件。