question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I set subscription quantity?

See original GitHub issue

After upgrading from 2.3.0 -> 2.4.0, I’m getting the following error message: “Received both items and quantity parameters. Please pass in only one.”

Looking at the docs, it seems like you need to pass quantity in the items price dictionary but the code in 2.4.0 doesn’t offer that flexibility.

What is the recommended approach to create a new subscription with a quantity > 1? Create a subscription and then subsequently call the update function? Won’t this create two invoices?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
arnav13081994commented, Aug 18, 2021

@onekiloparsec In the next release UsageRecord and UsageRecordSummary models will be available and syncing should work. Please note that Stripe doesn’t expose a way to retrieve UsageRecord objects directly so we sync them at creation time, similar to how you have done.

from djstripe.models import UsageRecord

# create and sync UsageRecord object
UsageRecord.create(id=<SUBSCRIPTION_ITEM_ID>, quantity=<SUBSCRIPTION_ITEM_QUANTITY>, timestamp=timestamp)

Relevant PR #1425

1reaction
jleclanchecommented, Nov 25, 2020

Eesh, sorry. Yeah this sucks a bit, will get it addressed for 2.5.0.

Try with charge_immediately=False in the mean time, I think it creates a draft invoice / you may be able to edit the invoice for a short time still. If that doesn’t work, you might have to copy the function locally for the time being and edit it to your liking.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting subscription quantities | Stripe Documentation
Setting subscription quantities. Vary the cost of a subscription by subscribing a customer to multiple quantities of a product.
Read more >
Change subscription quantity - PayPal Developer
Quantity -based, also known as user or seat-based, subscriptions allow consumers to subscribe to a plan and specify the number of units at ......
Read more >
Chart: Subscription Quantity - Help Center - ChartMogul
ChartMogul calculates Subscription Quantity as the total number of active or past due subscriptions multiplied by their quantities for each ...
Read more >
How to update Stripe subscription quantity? (Node.js)
The code is to find the SubscriptionItem that uses the Price you're looking for, and then update that item to have the quantity...
Read more >
Create Subscription - Recurly Documentation
You can use increase the number of subscriptions with the Quantity field for a plan. · You can create multiple subscriptions of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found