Stripe.Customers.listSources 没有返回任何东西

Stripe.Customers.listSources not returning anything

我创建了以下代码来为我的客户获取所有卡片:

return stripe.customers.listSources(customerId, {
    object: "card",
    limit: 10
}).then(cards => {
    if (cards) {
        res.status(200).send({
            cards: cards.data
        });
        return;
    }
    res
        .status(500)
        .send({ error: "error getting cards" });

})
    .catch(error => {
        console.log(error);
        res.status(500).send({ error: "error getting cards" });
    });

遵循此文档:

https://stripe.com/docs/api/cards/list

我还为我的客户添加了测试卡,这些卡在仪表板中可见:

但是 API 总是 returns 我得到以下结果:

{
  object: 'list',
  data: [],
  has_more: false,
  url: '/v1/customers/<my_cus_id>/sources'
}

似乎用这个代替有效:

stripe.paymentMethods.list(
   { customer: customerId, type: "card" }
)

https://stripe.com/docs/api/payment_methods/list