我创建了以下代码来获取客户的所有卡:
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 始终向我返回以下结果:
{
object: 'list',
data: [],
has_more: false,
url: '/v1/customers/<my_cus_id>/sources'
}
湖上湖
相关分类