Created
May 31, 2018 15:29
-
-
Save jaraco/6e17679a4bb3fe9868b90674e2409a17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import stripe | |
stripe.api_key = '...' | |
disc = stripe.Coupon.create(amount_off=189, currency='USD', duration='forever', id='nice-discount') | |
cust = stripe.Customer.create(description="nice customer") | |
prod = stripe.Product.create(name="Individual Lite", type='service') | |
plan = stripe.Plan.create(nickname='Monthly', amount=199, currency='USD', product=prod, interval='month') | |
sub = stripe.Subscription.create(customer=cust, items=[dict(plan=plan, quantity=0)], coupon=disc) | |
item, = sub['items']['data'] | |
item.quantity += 1 | |
item.save().quantity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment