首页 > 解决方案 > 条纹计费门户 NodeJS

问题描述

我在使用 NodeJS集成Stripe 客户计费门户时遇到了困难。请帮忙。

错误:

Cannot read property sessions of undefined.

标签: node.jsstripe-payments

解决方案


这个错误听起来像是被一行代码抛出的错误,看起来像

var session = await stripe.billingPortal.sessions.create({
  customer: 'cus_XXYYZZ',
  return_url: 'https://example.com/account',
});

可能是因为您没有正确导入 Stripe NodeJS 库,或者您使用的是8.45.0之前的版本,这是支持客户门户的 Stripe NodeJS 库的第一个版本。

您还应该确保仔细阅读并遵循 Stripe 文档中的客户门户指南,因为您应该了解一些细微差别。


推荐阅读