#A guy named Boris-python-promo-codes
1 messages · Page 1 of 1 (latest)
Hi 👋 can you tell me a bit more about what you're trying to do when you hit that error, and what your code looks like?
I have a coupon and I want to create multiple on-time promo codes for it. I follow this page https://stripe.com/docs/api/promotion_codes/create?lang=python
So I do something like:
COUPON_ID = 'XXXXX'
coupon = stripe.Coupon.retrieve(COUPON_ID)
which works, but when I do
stripe.PromotionCode.create(coupon="coupon['id']", code="VIPCODE")
I get
AttributeError: module 'stripe' has no attribute 'PromotionCode'
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
stripe.version.VERSION gives 2.49.0
Thank you for those details, I believe you'll need to update the stripe package as we added support for PromotionCodes in version 2.50.0 of our Python library:
https://github.com/stripe/stripe-python/releases/tag/v2.50.0
is 2.50.0 available via conda or pip? I can't find it
I'm not sure off-hand.
It looks like pip still has the previous versions of our package:
https://pypi.org/project/stripe/2.50.0/