#Sean
1 messages ยท Page 1 of 1 (latest)
Looking in to this. Is this line item from a subscription or something else?
The line item is from a subscription, yes
Gotcha, thank you. Still looking in to this and will get back to you.
I am getting a bit too busy in other threads but have pulled in a colleague. Out of curiosity have you tried the normal invoice item delete call?
I have not, but I did try pulling all InvoiceItems for the Invoice using the list call and that returned nothing
Here is a sample invoice that I am getting from the webhook I'm in. The item I am trying to delete is the only item in the lines field. I'm trying to delete that one and add my own InvoiceItem.
It looks like it is not currently possible to remove those invoice items from an invoice. I can put in a feature request to allow this, not sure why we don't already.
Trying to think of what you may want to do here. I assume you do want to charge for that subscription item at some point just not on this specific invoice right?
No, our use case is a little weird. We have a customer that has multiple sub-customers. The sub-customers are also billed via Stripe and they report their usage to a different customer. When the main customer is billed, we want to total up all of the usage from its' sub-customers and compare that against a minimum they agreed to in their contract. Whichever is higher is what we want to bill the main customer.
We have the infrastructure for tracking and retrieving all of this information in our local database, the problem is getting the invoice that is generated for the main customer to reflect the information we have.
Gotcha, not quite sure how best to handle these invoices in light of that. Going forward, it may be easier to create the invoice first and then create invoice items while specifying that invoice as the one to add the item to https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-invoice
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
As for existing subscription items on existing invoices I am less sure on what to do. Do you know if this was from a proration or just a normal subscription cycle?
The current workflow we have is:
- Sub-customers get an invoice at 1:00 on the 1st of the month. At this time, their usage is 'final' and is reflected in the invoice
- The main customer gets their invoice 12 hours later. We need to sum up all of the usage from the sub-customers' invoices and compare that against the minimum they agreed to on their contract. Whichever is higher should be reflected on their invoice.
As for your question, it was a normal subscription cycle
Currently, since we can't delete the subscription item, I'm thinking that we might just need to create a job that runs before the customer is invoiced to calculate and add their usage. Only reason I didn't want to do that is in case the customer's billing anchor was moved for some reason.
Ideally we could do one of three things. We could edit the line item for the subscription's quantity on the invoice, remove the subscription item and add our own line item, or add a minimum usage to the subscription (meaning, if the customer has 15 usage reported for the current billing cycle and their minimum is 50, they are billed for 50)
Are you using our usage based billing API or is this your own custom implimentation for usage? You can create a price that says "Charge $X for the first Y units" though that would require creating a new Price for each of your users with a different minimum agreed upon usage https://stripe.com/docs/billing/subscriptions/usage-based#product-modeling
Is the subscription on this main customer supposed to represent all usage? Or is the subscription on that customer some fraction of the total usage and you want to charge for that + every other sub customer's usage?
Yes, the subscription on the main customer is representative of the usage for all of their sub-customers.
Also, we are using a metered plan. Perhaps we are not using it to the fullest? Our customers agree to a minimum usage (say, for example 100 units). If they actually use less, they are billed for the minimum. They can increase their minimum in order to get a lower per-unit price. If we can find a way to implement minimums in the price on stripe side, that would be awesome.
In my example where the minimum is 100, let's say they are billed at a per-unit rate of $1. Any usage less than 100, they would be billed $100. Above that, they would be billed at total_usage * $1.
Can we accomplish this with your prices?
Hi ๐
I"m taking over as @obtuse prawn needs to go. Give me a sec to catch up
No problem. Thank you @obtuse prawn for your help!
I think our usage based pricing model allows you to set a minimum flat rate
The doc @obtuse prawn has already shared with you highlights how this could be accomplished
I'm slowly reading through it now. This would be a huge win for us if we can get it to work. Would make our side way easier!
This is something I'm going to look into more, but I think this will be an even better solution that I originally was looking for. Thanks a ton for your help, @sage flower and @obtuse prawn