I've created the following code to get all the cards for my customer:
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" });
});
following this documentation:
https://stripe.com/docs/api/cards/list
I've also added test cards to my customer which are visible in the dashboard:
but the API always returns me the following result:
{
object: 'list',
data: [],
has_more: false,
url: '/v1/customers/<my_cus_id>/sources'
}