【问题标题】:Stripe retrieving all subscriptions is empty检索所有订阅的条带为空
【发布时间】:2021-12-01 04:18:41
【问题描述】:

如下图所示,我的 Stripe 测试环境中有 1 个订阅处于活动状态。

但是当我尝试通过端点GET /v1/subscriptions 检索此订阅时,它为空。 https://stripe.com/docs/api/subscriptions

$stripe = new \Stripe\StripeClient(env('STRIPE_SECRET'));
$list = $stripe->subscriptions->all();
print_r($list);

结果:

Stripe\Collection Object
(
    [object] => list
    [data] => Array
        (
        )

    [has_more] => 
    [url] => /v1/subscriptions
)

我已经仔细检查过,我正在使用测试密钥。

另外,如果我尝试使用端点 GET /v1/subscriptions/:id 检索单个订阅:

$stripe->subscriptions->retrieve('sub_....', []);

返回错误:

没有这样的订阅'sub_.....'

并且 ID 完全正确(只是从 Stripe 仪表板复制并粘贴)。

【问题讨论】:

  • 你是不是把 TEST_MODE 和 PROD_MODE 搞混了?
  • @Ivan 否定,正如您在打印屏幕中看到的那样,我的测试模式处于活动状态。

标签: php stripe-payments


【解决方案1】:

如果您无法通过 ID 直接检索订阅,则您可能混淆了来自不同帐户的密钥。仔细检查您登录的帐户以及密钥所属的帐户,然后重试。

【讨论】:

    猜你喜欢
    • 2021-12-12
    • 2018-12-09
    • 2018-09-20
    • 2019-09-13
    • 2021-12-12
    • 2021-06-17
    • 2015-02-20
    • 2021-06-13
    • 2022-01-01
    相关资源
    最近更新 更多