A resource is used, when is the usage metered? If your instance is priced by run time when is that metering durably recorded? End of a time period, a billing period (oops! Havent got to billing periods yet!), on resource state change?
Assume you have a bunch of metering records. What price do you apply? There are LOTS of prices, even for the same thing. So now we need to know per account/service/region/contract/whatever the price to apply to the metering data. Oh no! The final price depends on aggregate usage! We cant determine the “price” for any single metering record without knowing cumulative usage. So now we have to aggregate total usage and apply the different marginal prices before we can determine any single price :(
Now we have lots of metering data + pricing data, lets make a bill. Who is the bill for? An account, a group of accounts, an organization? I hope you dont support credits, discounts, or similar that cross accounts. In practice the answer is probably “yes” and you e run in to another round of aggregation.
This isnt specific to SaaS, but describes billing in general. Its not A hard problem, its Many hard problems. And that general pattern of business problems is why you see most (all?) providers end up at a process that looks like recurrent batch computations.
Disclaimer: principal at AWS, but do not work in the metering/billing space directly. None of the above is specific to my employer and solely my personal observations/opinions.