-
Notifications
You must be signed in to change notification settings - Fork 455
Description
Describe the bug
When trying to clear out the list of previously set blocked_categories on a cardholder, calling
stripe.issuing.Cardholder.modify(
"ich_...",
spending_controls={'blocked_categories': []},
stripe_account="acct_...",
)
returns successfully but doesn't clear out the blocked_categories on the cardholder and returns a cardholder instance with the previous blocked_categories list still set.
Instead, it is necessary to replace [] with "":
stripe.issuing.Cardholder.modify(
"ich_...",
spending_controls={'blocked_categories': ""},
stripe_account="acct_...",
)
and that successfully clears the list of blocked_categories—however, there is no mention of the need to make this distinction when calling stripe.issuing.Cardholder.modify or any other method in the Stripe API docs or this library's docs and setting a list to empty by setting its value to "" is not valid Python syntax.
To Reproduce
- create a stripe connect account via:
stripe.Account.create(
type="custom",
country="US",
email="testaccount@emailprovider.com",
requested_capabilities=["transfers", "card_payments", "card_issuing"],
)
- complete any requested test KYB information to ensure the account is fully verified and approved
- create a cardholder via:
stripe.issuing.Cardholder.create(
name="Jane Doe",
email="testcardholder@emailprovider.com",
status="active",
type="individual",
billing={
"name": "Jane Doe",
"address": {
"line1": "117 West St",
"line2": None,
"city": "New York",
"state": "NY",
"country": "US",
"postal_code": "10006",
},
},
spending_controls={'blocked_categories': ['floor_covering_stores']},
stripe_account="acct_...", # id of the account created above
)
- attempt to update the cardholder via:
stripe.issuing.Cardholder.modify(
"ich_...", # id of the cardholder created above
spending_controls={'blocked_categories': []},
stripe_account="acct_...", # id of the account created above
)
Expected behavior
Setting a list to [] should set that list to empty. It is not intuitive or valid Python syntax to set a list to empty by setting its value to "".
Code snippets
See code snippets in the "Describe the bug" and "To Reproduce" sections
OS
macOS
Language version
Python 3.10.2
Library version
stripe-python v2.67.0
API version
2019-10-17
Additional context
No response