stripe-node
stripe-node copied to clipboard
Library possible stripping part of billingPortal.configurations.create request?
I am making the following call:
const args = {
"business_profile": {
"headline": "Column PBC"
},
"features": {
"customer_update": {
"enabled": "false",
"allowed_updates": []
},
"invoice_history": {
"enabled": "true"
},
"payment_method_update": {
"enabled": "true"
},
"subscription_cancel": {
"enabled": "false"
},
"subscription_update": {
"enabled": "false"
}
}
};
await stripe.billingPortal.configurations.create(args):
However I get the following error:

I was only able to solve this by removing the features.customer_update field entirely, but I think there may be a bug in this library.
Hello @samatcolumn,
Thank you for writing in. I agree this behavior is confusing.
This has to do with how the Stripe API uses form encoding for request parameters, and how we translate arrays into form encoding. For example, if allowed_updates wasn't empty, the request would look something like:
POST /v1/billing_portal/configurations
...
features[customer_update][allowed_updates][]=...&features[customer_update][allowed_updates][]=...
this means that the way to encode an empty array is just to send nothing at all - which this API is complaining about, because it sees allowed_updates as a required field.
I don't know yet if there is a straightforward fix for this, but I will raise it internally.