Stripe resource not parsing arrays correctly

Hello,

I have been facing an issue when trying to pass in array type parameter in a query to Stripe Resource. For example, when I query GET /v1/prices endpoint, I pass lookup_keys parameter, which must be an array of Strings. However, when I do so using the Stripe resource, I get an invalid_array error in response from Stripe API. The Stripe resource parses the parameters and builds the URL like this:

https://api.stripe.com/v1/prices?active=true&lookup_keys=lookup_key1&lookup_keys=lookup_key2

Whereas, it should instead look like this:

https://api.stripe.com/v1/prices?active=true&lookup_keys[]=lookup_key1&lookup_keys[]=lookup_key2

Thank you!

Hey @PatrickMast, is it possible to get some help on this one? Thanks!

Hi @fyz,

To pass an array parameter to the Stripe API using the Retool Stripe resource, you can follow these steps:

  1. In your query, set the lookup_keys parameter to a JavaScript array of strings, like this:

    ['lookup_key1', 'lookup_key2']
    
  2. Enable the "Evaluate query params" option in the Stripe resource settings. This will ensure that the array is properly serialized before sending the request to the Stripe API.

By enabling "Evaluate query params", Retool will correctly format the lookup_keys parameter as an array in the URL, like this:

https://api.stripe.com/v1/prices?active=true&lookup_keys[]=lookup_key1&lookup_keys[]=lookup_key2

This should resolve the invalid_array error you encountered and allow you to successfully query the Stripe API with array parameters.

Hope this helps.

:grinning:

Patrick

Hello @PatrickMast

Thank you for your response. However I cannot find any option named "Evaluate query params" in Stripe resource settings.

Without it, Stripe resource still parses the array incorrectly. However this only happens in GET requests. I have discovered that POST requests are not affected by this, as the array parameter is in the body.

Hi @fyz Thanks for reaching out! Unfortunately, this is a Retool bug :disappointed:

Until we ship a fix, best workaround I know of is to use the Rest api integration instead of the Stripe integration

1 Like