Member-only story
Using Inbox & Outbox Patterns for Better Efficiency
It is imperative to maintain data integrity, consistency, and reliability when working with the Billing service. Any missing or redundant data could lead to incorrect invoices and charges to customers and incorrect numbers for the finance department.
On the other hand, building a billing system from scratch is expensive. It requires not only technical effort but also integration with banks, working with authorities on taxes, laws, etc. Fortunately, many payment providers offer full-fledged payment and subscription functionality. Therefore, instead of reinventing the wheel, the billing team should focus on their business, for example, how to collect usage, calculate amounts, etc.
Using third-party payment providers has obvious advantages. However, introducing new integrations will increase the system’s complexity and introduce one more point of failure.
In this article, we will see how the Inbox & Outbox patterns are applied to the billing service.
This is the simplest version and is straightforward to understand. The Billing service needs to send requests to Stripe to record subscriptions, usage, etc. And it is also need to register webhook events from Stripe to know when an invoice is finalized or paid, and when a payment succeeds or failed.