Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library possible stripping part of billingPortal.configurations.create request? #1371

Open
samatcolumn opened this issue Mar 16, 2022 · 1 comment
Assignees

Comments

@samatcolumn
Copy link

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:
image

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.

@remi-stripe remi-stripe self-assigned this Mar 16, 2022
@richardm-stripe
Copy link
Contributor

richardm-stripe commented Mar 16, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants