1

This should be really simple but I'm somehow screwing it up. I'm literally just trying to log a list of customers when I go to /customers:

router.get('/customers', function(req, res){
        var customers = STRIPE_API.listCustomers();
           console.log(customers);
    });

This is the listCustomers function:

function listCustomers(){
var customers = stripe.customers.list(
  {limit: 3},
  function(err, customers) {
    // asynchronously called
  })
    return customers;
};

I'm expecting an object to be returned that has a property "data" which contains an array of all of my customers. So I should be able to console.log(customers.data) and get an array of customers. Anyway, when I console.log(customers) all I get is:

Promise {
  <pending>,
  autoPagingEach: [Function: autoPagingEach],
  autoPagingToArray: [Function: autoPagingToArray],
  next: [Function: asyncIteratorNext],
  return: [Function: return],
  [Symbol(Symbol.asyncIterator)]: [Function: [Symbol.asyncIterator]] }

which - I don't even know what that is. Any ideas? I've been trying to figure this out for a while today.

Thanks in advance!

Justin Y
  • 11
  • 2
  • 1
    @MarcosCasagrande Yes, it does! Thank you so much. It's working exactly as expected now. I think my inexperience is showing here. I appreciate you taking the time to point me in the right direction. Cheers! – Justin Y Dec 22 '19 at 19:26

0 Answers0