根据客户电子邮件 Stripe JS 获取订单列表的方法

Way to fetch list of orders based on customer email StripeJS

我正在使用 nextjs 构建一个小型电子商务网站以了解 Stripe,我想知道是否有办法根据用户电子邮件或 customer_id 获取所有订单的列表这将包括他们购买的产品。我一直在查看他们的文档,但我唯一能找到的是我没有使用的订阅。

谢谢!

如果使用 PaymentIntents,您可以通过传递客户 ID 列出特定客户的所有付款。在 Node.js 中,它看起来像这样:

const paymentIntents = await stripe.paymentIntents.list({
  customer: "cu_xxx"
});

如果需要,您可以做类似的事情with charges