You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed (and found a workaround to solve) a bug occurring in GET requests with data containing arrays.
For example: stripe.invoices.retrieve('upcoming', {..., subscription_items: [..., ...] })
This will try to make a GET request with url-encoded data (in the body of the request apparently(?)), but the converted querystring doesn't** have array indexes.
**: purposely, according to the commit found via blame ; and also according to the 'Stripe-specific cases' test in utils.spec.js)
Thing is: Stripe API seems to need them to understand the query.
This also appears to happen with POST requests. I discovered while trying to create products with attributes for the first time and encountered range errors.
Converting the array to an integer indexed object (as shown in the workaround posted by @richie3366) fixed the issue.
I noticed (and found a workaround to solve) a bug occurring in GET requests with data containing arrays.
For example:
stripe.invoices.retrieve('upcoming', {..., subscription_items: [..., ...] })
This will try to make a GET request with url-encoded data (in the body of the request apparently(?)), but the converted querystring doesn't** have array indexes.
**: purposely, according to the commit found via blame ; and also according to the 'Stripe-specific cases' test in utils.spec.js)
Thing is: Stripe API seems to need them to understand the query.
Current code in utils.js:
outputs:
urldecoded:
Log trace in Stripe Dashboard:
With workaround:
outputs:
urldecoded:
Log trace in Stripe Dashboard:
So, either you have to fix it in your API backend (to accept unindexed array backets), or fix it here (to provide API compatible format).
Thanks.
The text was updated successfully, but these errors were encountered: