Fix stripe.Customer.create() bug (quantity) in 3.4.0 #332
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
3.4.0 introduced PR#319, which causes this error for some people now when trying to create/sync customers:
InvalidRequestError: Request req_AV0P60vqXmdxUj: Received unknown parameter: quantity
This appears to occur when a user doesn't have a DEFAULT_PLAN set in their settings.py (which is optional), and the app default for this is None. Stripe's API (locked down to version 2015-10-16 by default in this project) does not allow a quantity to be set without a plan.
This changes the default for 'quantity' to None, which makes it behave correctly. The API sets this to '1' by default anyway if a plan is specified with no quantity according to https://web.archive.org/web/20150619020503/https://stripe.com/docs/api#create_customer)
(As an aside, the current version of the API doesn't support any of these parameters - subscriptions are dealt with entirely separately to customers - would you accept a seperate PR to this retargeting the app towards the current Stripe API?)