#Mohana-Subscription
1 messages ยท Page 1 of 1 (latest)
I have a product that has metered billing. I would like to have a line item in the subscription that will be charged as per the usage in the metered product. Let's say I have consumed 1000 units (1 unit = 1$), i would like to add a line item that is 10% of the usage or 50$ whichever is lower.
OK, so basically you want to add additional item to the monthly invoice, am I right?
Got it, you can listen to the invoice.created webhook event, and add the invoice item to the newly generated invoice.
cool ! is there any way to show this item during subscription creation ?
in a stripe checkout page
If you add the item during checkout, then this item will be included as a monthly recurring subscription item instead of an ad-hoc item.
okay ๐ thanks Jack
@tiny salmon I think we missed the percentage part
So if i have to add the line item, then i would have to create a new price right ?
like 1 customer can have usage of 900 units for whom the additional line item would be 90$ and another customer can have usage of 100 units for whom the additional line item would be of 50$
You can use the invoiceItems's price_data field to create an ad-hoc price (https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-price_data)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Actually for every invoice.