stripe / stripe-node

Node.js library for the Stripe API.
https://stripe.com
MIT License
3.81k stars 741 forks source link

customer has no cards or sources #618

Closed adrai closed 5 years ago

adrai commented 5 years ago

Directly in the stripe UI I can see the customers cards as expected. But when fetching via the library I always get empty cards or sources:

stripe.customers.retrieve('cus_F1vOVkGDcfC1EF', (err, customer) => {
  console.log(customer);
  /* sources: {
    object: 'list',
    data: [],
    has_more: false,
    total_count: 0,
    url: '/v1/customers/cus_F1vOVkGDcfC1EF/sources'
  }, */
});

stripe.customers.listCards(
  'cus_F1vOVkGDcfC1EF',
  (err, cards) => {
    console.log(cards);
  /* {
  object: 'list',
  data: [],
  has_more: false,
  url: '/v1/customers/cus_F1vOVkGDcfC1EF/cards'
}  */
  }
);
remi-stripe commented 5 years ago

@adrai It looks like you are using PaymentMethods today and not Cards or Sources. Those are entirely separate objects but PaymentMethods are the newer one and a better integration path.

To list PaymentMethods on a Customer you have to use a dedicated API for this: https://stripe.com/docs/api/payment_methods/list

Closing this as it's not a bug with the library but don't hesitate to reach out to our support team if you have any follow-up questions: https://support.stripe.com/contact

adrai commented 5 years ago

thx for the hint