8000 feat(multi-entities) Invoices services with billing entities by ancorcruz · Pull Request #3371 · getlago/lago-api · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(multi-entities) Invoices services with billing entities #3371

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

Merged
merged 8 commits into from
Mar 26, 2025

Conversation

ancorcruz
Copy link
Contributor
@ancorcruz ancorcruz commented Mar 24, 2025

This PR depends on #3377 that needs to be merged first.

Roadmap Task

👉 https://getlago.canny.io/feature-requests/p/support-billing-from-multiple-entities

Context

Users who invoice the same products across multiple entities face the challenge of managing separate Lago organizations.

This requires duplicating all billable metrics, plans, and setup, while also implementing additional logic to handle two different API keys and ensure the correct one is used for each affiliated entity. This process adds complexity and overhead to their billing operations.

Description

On invoice generation assign customer's billing entity reference.

Also assign all existing Invoices to the organization default billing entity (matching the organization_id). This is needed to later implement and populate the billing_entity_sequential_id for each invoice.

@ancorcruz ancorcruz self-assigned this Mar 24, 2025
this service is needed for an smooth migration to multientities allowing
single entity organizations to skip the billing entity code in their
requests.
also apply some code improvements to the service to improve code
expressiveness
as part of the multi entity migrations we assign all existing invoices
to the default (and first) billing entity matching the billing_entity_id
with the organization_id of the invoices as it is expected the ids are
the same...
@ancorcruz ancorcruz force-pushed the feat/multientities/invoices-services branch from 929cb02 to 30f8c23 Compare March 25, 2025 18:50
@ancorcruz ancorcruz marked this pull request as ready for review March 25, 2025 18:53
@ancorcruz ancorcruz requested a review from annvelents March 25, 2025 18:54
Copy link
Contributor
@annvelents annvelents left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@ancorcruz ancorcruz merged commit 300be88 into main Mar 26, 2025
6 checks passed
@ancorcruz ancorcruz deleted the feat/multientities/invoices-services branch March 26, 2025 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Deve 3730 lopment

Successfully merging this pull request may close these issues.

2 participants
0