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') |
I set up the localstripe package in my python backend but It's throwing
Bad Requesterror here: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
priceitems yet and localstripe only supportsplanitems.localstripe/localstripe/resources.py
Lines 2353 to 2369 in 591f3b5