#Amar

1 messages · Page 1 of 1 (latest)

sharp ginkgoBOT
turbid fox
#

That way you can define how we should change your subscriptions and when ahead of time and we will change them automatically and right on time

#

If you want to do this yourself, you can listen to invoice.created events and can edit these invoices for up to an hour after they have been created

silver jolt
#

Thanks Pompey

#

But if I update the invoice after receiving the invoice created event, that won't update the subscription quantity will it?

turbid fox
#

My apologies, I misspoke. You can update the subscription itself in this hour. That being said the subscription schedule would be a way better way to do this

#

With the schedule you wouldn't have to time things like this. You could just set the subscription items that you want as soon as you know you want them on the next bill

silver jolt
#

Ah but I won't know the quantity

#

So the job runs, it does a calculation based on a database query to output a quantity of consumption

#

Then I need to update the users subscription + subsequent invoice to change the line item quantity to that ca;culated quantity

#

this will change every month

#

So I can't do it with schedules

#

What would be the best approach to take, with this new information?

turbid fox
#

You could report usage throughout the month and we could calculate total usage automatically

silver jolt
#

I did look at that, but i dont need to report throughout the month

#

I just need to work it out once

#

Also, this gets reset every month, whereas I would need a persistent quantity as the usage is rolling

turbid fox
#

Gotcha, in that case I believe you can listen for the invoice.created event and make your updates to the subscription then

silver jolt
#

And this will update the invoice in real time?

turbid fox
#

I believe so but the server is a bit too busy to test. Have you tested making updates like this? Would be a quick way to determine if this fits your needs

silver jolt
#

I dont think updates a created invoice

#

I tried in the portal and it said this would update the next invoice in 1 month, not the current created invoice

turbid fox