Stripe.Customers.listSources不返回任何内容

问题描述 投票:0回答:1

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

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

我还向客户添加了可在仪表板中看到的测试卡:

enter image description here

但是API始终会向我返回以下结果:

{
  object: 'list',
  data: [],
  has_more: false,
  url: '/v1/customers/<my_cus_id>/sources'
}
javascript node.js stripe-payments credit-card
1个回答
0
投票

似乎使用它代替了:

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

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

© www.soinside.com 2019 - 2024. All rights reserved.