#josh-invoice-usage

1 messages · Page 1 of 1 (latest)

pseudo yarrowBOT
lament cipher
#

@queen rain are you doing recurring payments? Or is it just one Invoice for that month?

#

josh-invoice-usage

queen rain
#

I'm doing a recurring monthly subscription, but also want to charge for other products that the user can purchase throughout the month. So essentially fixed monthly + metered.

But the reason I'm not using the built in metered pricing is because I also want to offer yearly subscriptions, but charge monthly for those additional products. Which is why I'm using pending invoice items, as I can set the subscription to automatically create an invoice (on a monthly basis) and include those pending invoice items.

#

(even when the subscription base price is set to a yearly interval)

#

But because there can potentially be more than 250 instances of these additional charges, I need to just have one invoice item line item per product, and update the quantity throughout the month. But the api only allows for setting the quantity value, not incrementing. So I'm wondering what the best method for avoid race conditions would be

lament cipher
#

I would strongly recommend using metered billing + Subscriptions still

#

trying to do this by hand is going to be extremely hard and you will hit those race conditions and such. I would recommend 2 parallel Subscriptions, one for the yearly Price and one for the monthly usage.
Or just the monthly Subscription first and then once a year you add the one-time yearly fee to the Invoice

queen rain
#

Yea, the two subscription thing is another option. I guess where that becomes more complicated is when a customer wants to switch between yearly <--> monthly for the subscription.

lament cipher
#

yep that's fair, definitely not easy to do what you're after. But trying to do your own usage Invoices is going to be a lot harder

queen rain
#

okay. thank you for the help!

lament cipher
#

sure thing!

#

If you do the Invoice then really I'd recommend basically one InvoiceItem for usage that you update hourly or daily

#

and then your code makes sure you don't update 2 things at once

queen rain
#

yea thats kind of what I was thinking for that route. Just have a recurring job that runs once an hour to update the quantities for the invoice items for each customer once, based on usage instead of doing it in the live path.

#

but the metered plan would obv be easier, theres trade offs for both options (two subscriptions vs. manual tracking usage)

lament cipher
#

yeah exactly

pseudo yarrowBOT