Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metered invoicing support #36

Open
mahmoudimus opened this issue Aug 26, 2013 · 3 comments
Open

Metered invoicing support #36

mahmoudimus opened this issue Aug 26, 2013 · 3 comments
Milestone

Comments

@mahmoudimus
Copy link
Contributor

Balanced internally has built its own (very simple) metered billing system to instrument our customer's use of the API.

We collect some statistics on their usage and at 0:00 UTC every day, we generate an invoice for that business day and then settle it.

I want to move this logic out of Balanced and into Billy. Ergo, Billy should support metered billing support and the Balanced dashboard should use Billy to display the invoices for our customers.

/cc @victorlin @mjallday @kleinsch

@mjallday
Copy link
Contributor

How would this work? Would Balanced generate a list of customers and amounts and then call out to Billy's API in order to handle billing?

Billy would need to support pushing notifications to customers via email since Balanced currently does this to notify of failed invoice charges. Possibly Billy could support webhooks instead and call back on failed charge attempts as an interim step.

@mahmoudimus
Copy link
Contributor Author

The idea is that the pricing page (balanced/www.balancedpayments.com#14) should be implemented using Billy. How can we integrate Balanced into Billy?

Since Balanced puts a ton of focus on eating its own dog-food, Billy should be used as its invoicing tool. How can we do this via Billy?

That logic should be in Balanced, where Balanced queries Billy for instrumented events (for each customer) and then Balanced should tell Billy to generate the invoice for each customer. Billy can then handle the invoicing part.

@fangpenlin
Copy link
Contributor

@mahmoudimus
My understanding here is, billy monitors and collects events from balanced (via the web hook). Then billy generates invoices for customer everyday. Is this correct?

As the balanced service is already doing invoicing, and I think it is doing it correctly. So, I can make billy to generate invoices, run it for a while, compare the output to see is billy working correctly. And eventually migrate the invoicing to billy.

However, I would like to know the rationale for moving the invoicing logic from balanced to billy. Is that for reducing complexity of balanced? With the rationale, I can do better design to meet the reason behind this change. Also, I would like to know what do you what to keep in balanced? What to keep in billy then? For example, should I put pricing logic (the part for determining amount of invoice to charge customer) in balanced or billy? With clear role responsibility definition, I can also do a better design then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants