3

I am using Stripe with nodejs to get a list of say all the charges, with the total_count included in the results. I call it like this:

stripe.charges.list({include: ['total_count'] }, cb)

But I get the following error back from the API:

Unhandled rejection Error: Invalid array

(Leaving off the include parameter returns the results fine.)

Am I specifying the include parameter incorrectly?

Joerg
  • 3,553
  • 4
  • 32
  • 41

1 Answers1

3

I just tried on my end and this code worked as expected:

stripe.charges.list(
  { limit: 3 , "include[]": "total_count"},
  function(err, charges) {
    console.log("Charges : ", JSON.stringify(charges));
  }
);
koopajah
  • 23,792
  • 9
  • 78
  • 104
  • Ah formatting the parameters like that work. Thanks for that. I've been using the Ruby gem for stripe and you pass in an array for the include parameter. The notation just confused me. – Joerg Apr 30 '15 at 13:21
  • Note that a developer from Stripe has indicated that "total_count" has been deprecated: https://github.com/stripe/stripe-dotnet/issues/813#issuecomment-441677431 – Peter W Aug 20 '19 at 22:38