Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Prices and attaching Price items to subscriptions #160

Open
NomanGul opened this issue Oct 21, 2020 · 2 comments
Open

Support for Prices and attaching Price items to subscriptions #160

NomanGul opened this issue Oct 21, 2020 · 2 comments

Comments

@NomanGul
Copy link

NomanGul commented Oct 21, 2020

I set up the localstripe package in my python backend but It's throwing Bad Request error here:

                trial_end = (date.today() + relativedelta(months=+1)).strftime('%s')
                subscription_items = [{
                    "price": "price_xxxxxxxxxxxxxxx"
                }]
                subscription = stripe.Subscription.create(
                    customer=customer.id,
                    trial_end=trial_end,
                    items=subscription_items,
                )

I searched into the GitHub issues but found nothing related. after that, I dig into the source code of localstripe and found out localstripe did not support price items yet and localstripe only supports plan items.

for item in items:
assert type(item.get('plan', None)) is str
if item.get('quantity', None) is not None:
item['quantity'] = try_convert_to_int(item['quantity'])
assert type(item['quantity']) is int
assert item['quantity'] > 0
else:
item['quantity'] = 1
item['tax_rates'] = item.get('tax_rates', None)
if item['tax_rates'] is not None:
assert type(item['tax_rates']) is list
assert all(type(tr) is str for tr in item['tax_rates'])
assert type(enable_incomplete_payments) is bool
assert payment_behavior in ('allow_incomplete',
'error_if_incomplete')
except AssertionError:
raise UserError(400, 'Bad request')

@adrienverge
Copy link
Owner

Hello Noman,

You're correct, price is not yet supported when creating a subscription in localstripe.
Contributions are welcome, however you must be warned that all the code around Subscription and Invoice objects is very complicated, so I'm not sure how easy it would be to add support for price, without breaking something else.

@ajpetersons
Copy link

Hi

We are also using localstripe, and would really appreciate support for Price. As we have implemented Stripe recently and Prices replace Plans, we did not really consider using Plans

@adrienverge adrienverge changed the title Attaching Price Item to subscription Support for Prices and attaching Price items to subscriptions Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants