stripe / stripe-python

Python library for the Stripe API.
https://stripe.com
MIT License
1.64k stars 418 forks source link

Typing issue: additional_verifications missing in `stripe.Account.CreateParams` #1320

Closed zintegy closed 4 months ago

zintegy commented 4 months ago

Describe the bug

additional_verifications isn't defined in CreateParams. This poses issues with typing when creating an account with additional_verifications like us_w8_or_w9, tax_id, or address:

return stripe.Account.create(
    type="express",
    country=country,
    additional_verifications=_get_additional_verifications(
        country, earnings_over_tax_info_threshold
    ),
    capabilities=_get_capabilities(country),
    tos_acceptance={"service_agreement": _get_service_agreement(country)},
    api_key=a.model.earnings.producer.stripe.get_stripe_spaces_secret_key(),
    stripe_version=stripe_api_version.get(),
)

To Reproduce

  1. Write the following code:
import stripe

api_key = "***"  # loaded from env

account = stripe.Account.create(
    type="express",
    country='US',
    additional_verifications={'tax_id': {'requested': True, 'upfront': [{'disables': 'payouts_and_payments'}]}},
    api_key=api_key,
)
  1. Run a type checker. I use pyanalyze.
  2. You will run into a typing error claiming that additional_verifications is not a valid parameter.

Expected behavior

By adding additional_verifications into stripe.Account.CreateParams, this typing error should no longer occur.

Code snippets

No response

OS

macOS

Language version

3.9.14

Library version

stripe-python 9.4.0

API version

2024-04-10

Additional context

No response

remi-stripe commented 4 months ago

@zintegy the additional_verifications parameter is not a publicly documented parameter in our Create Account API. You are using a beta feature that is likely enabled specifically for your Stripe account but it's not publicly available to most users. Our stripe-python SDK only has types for public APIs and parameters and not for any of our beta features at the moment so the type error is expected in that case.

I'm going to close as this is expected behaviour at the moment until the day this feature becomes public!