My stripe account is in test mode.
I request all sources (with cards) for a given customer using:
curl "https://api.stripe.com/v1/customers/cus_FWzlniSobJD2yO/sources" \
-u sk_test_SECRET_KEY: \
-G
I get the following response:
{
"object": "list",
"data": [
],
"has_more": false,
"url": "/v1/customers/cus_FWzlniSobJD2yO/sources"
}
You can see that 'data', that should contain the customer's payment sources, is empty.
The cards have been saved from the front with stripe.js using:
stripe.handleCardPayment(intentClientSecret, cardElement, {
payment_method_data: {
billing_details: {name: 'Firstname Lastname'}
},
save_payment_method: true
});
Cards appearing in customer's details in my dashboard:
Although the cards are listed in the dashboard and the documentation says the request in OP should allow you to retrieve all cards, cards attached to a customer through "save_payment_methods" are not part of his "sources" but of his "payment_methods". Both are different APIs serving the same purpose, the latest being the newest and recommended way of doing things.
They are accessible through:
curl "https://api.stripe.com/v1/payment_methods?customer=cus_FWzlniSobJD2yO&type=card" \
-u sk_test_SECRET_KEY: \
-G
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With