【问题标题】:stripe.prices.create: Cannot read property 'create' of undefinedstripe.prices.create:无法读取未定义的属性“创建”
【发布时间】:2020-06-29 06:13:51
【问题描述】:

我正在尝试按照以下文档创建条带价格:https://stripe.com/docs/api/prices/create

这是我的代码:

        const stripe_price = await stripe.prices.create({
          product: stripe_product.id,
          unit_amount: parseInt(params.amount),
          currency: 'usd',
          recurring: {
            interval: productDefinition[0].charge_period,
          },
        });

我的预期输出是获取价格对象,但得到“无法读取未定义的属性'create'”。

我可以确保我导入的条带和条带版本使用的是 7.15.0

【问题讨论】:

    标签: node.js stripe-payments


    【解决方案1】:

    Price 资源和 API 于 2020 年 4 月末发布。这意味着您需要使用足够新的条带节点(或其他库)版本才能使用它。您提到您在 December 2019 中发布的条带节点的 7.15.0,因此使用这些新 API 太旧了。

    要使用Price API,您需要至少升级到其changelog 中介绍的 8.48.0。

    【讨论】:

    • 谢谢,我的错误是我认为价格 API 是与 7.15 版左右发布的 Intent API 一起发布的
    猜你喜欢
    • 1970-01-01
    • 2020-10-15
    • 2020-05-28
    • 2021-09-13
    • 1970-01-01
    • 2017-05-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多