Javascript Stripe.Customers.listSources不返回任何内容
我创建了以下代码来为我的客户获取所有卡:Javascript Stripe.Customers.listSources不返回任何内容,javascript,node.js,stripe-payments,credit-card,Javascript,Node.js,Stripe Payments,Credit Card,我创建了以下代码来为我的客户获取所有卡: return stripe.customers.listSources(customerId, { object: "card", limit: 10 }).then(cards => { if (cards) { res.status(200).send({ cards: cards.data }); return; } res
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" });
});
遵循本文件:
我还向客户添加了测试卡,这些测试卡在仪表板中可见:
但API总是返回以下结果:
{
object: 'list',
data: [],
has_more: false,
url: '/v1/customers/<my_cus_id>/sources'
}
{
对象:“列表”,
数据:[],
有更多:错误,
url:“/v1/customers//sources”
}
使用此选项似乎更有效:
stripe.paymentMethods.list(
{ customer: customerId, type: "card" }
)