#luanvdw-subscription
1 messages ยท Page 1 of 1 (latest)
Hi there, can you elaborate more on is it possible to create usage records with multiple quantity allocations? So that one can differentiate usage between A and B ? Or show me an example?
Hi Jack!
Thank you for your response, certainly
The end goal is essentially to subscribe a user to subscription that consists of;
- a base flat fee
- metered usage of element A
- metered usage of element B
example
Starter plan;
Base price $10 / mo
includes 2 projects [$3 / additional project / mo]
includes 3 member [$3 / additional member / mo]
When creating the subscription with multiple price ids in items: []
How would one be able to differentiate between project usage and member usage on the subscription?
The quantity field on a usage record for a subscription does not seem to extend to providing different quantities to different products within a single subscription
Let me know if this helps and if I can provide any additional information ๐
Got it, so basically you want to report the usage for product and member respectively.
project and member respectively yes
Subscription: {
items: [
price_flat_fee
price_metered_projects
price_metered_members
]
}
And would like to track and manage usage for projects and members respectively
If that helps ๐
OK, so when you create the usage record, you need to pass the subscription item ID, e.g.
const usageRecord = await stripe.subscriptionItems.createUsageRecord(
'si_KYWA7VZRZ5Gwfb',
{quantity: 100, timestamp: 1571252444}
);```
and the subscription item should correspond to the product/price in your subscription.
So in the example above, si_KYWA7VZRZ5Gwfb is the product/price combination in the subscription?
Just to make sure I understand correctly
So after you creating a subscription, you will see see subscription items in the items array of the subscription https://stripe.com/docs/api/subscriptions/object?lang=node#subscription_object-items
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ah! Now I get it ๐ก okay great,
So we create usage records based on the ids that are then contains in that array after having created the subscription?
The subscription item contains the information of the price (i.e., project or member), and you can use this subscription item ID to create usage records