#luanvdw-subscription

1 messages ยท Page 1 of 1 (latest)

maiden wagon
#

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?

dapper dagger
#

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 ๐Ÿ™‚

maiden wagon
#

Got it, so basically you want to report the usage for product and member respectively.

dapper dagger
#

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 ๐Ÿ™‚

maiden wagon
#

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.

dapper dagger
#

So in the example above, si_KYWA7VZRZ5Gwfb is the product/price combination in the subscription?

#

Just to make sure I understand correctly

maiden wagon
dapper dagger
#

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?

maiden wagon
#

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

dapper dagger
#

and not the overall subscription id (which is what I originally thought)

#

This is great! Ill check it out now, thanks Jack!