[ING-70] feat(multi-entity): billing_entity scoping across endpoints#546
Merged
Conversation
## Context The Lago API now lets callers pin a subscription, wallet, or one-off invoice to a specific billing entity within a multi-entity organization, returns the resolved entity on subscription and wallet responses (invoice and credit_note already exposed it), and accepts `billing_entity_codes[]` as a list filter on the subscription, wallet, and payment_request indices (the invoice and credit_note lists already supported it). ## Description Adds `billing_entity_code` on `SubscriptionUpdateInput`, `SubscriptionObject`, `WalletCreateInput`, `WalletUpdateInput`, `WalletObject`, and `InvoiceOneOffCreateInput`. The `SubscriptionCreateInput`, `InvoicePreviewInput`, `InvoiceBaseObject`, and `CreditNoteObject` schemas already declared the field. Adds the `billing_entity_codes[]` query filter to `/subscriptions`, `/customers/:external_customer_id/subscriptions`, `/wallets`, `/customers/:external_customer_id/wallets`, `/payment_requests`, and `/customers/:external_customer_id/payment_requests`. No new schemas, parameters, or index entries; the regenerated top-level `openapi.yaml` propagates the changes.
aquinofb
approved these changes
Jun 24, 2026
toommz
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reflects the multi-entity billing API change in the spec. Callers can now pin a subscription, wallet, or one-off invoice to a specific billing entity within a multi-entity organization, read the resolved entity back from subscription and wallet responses (invoice and credit_note already exposed it), and filter the subscription, wallet, and payment_request list endpoints by
billing_entity_codes[](the invoice and credit_note lists already supported it).Changes
Schemas —
billing_entity_code(string) added to:SubscriptionUpdateInput—PUT /subscriptions/:external_id. Mutable, takes effect on future invoices.SubscriptionObject— read back on every subscription response.WalletCreateInput—POST /wallets(also coversPOST /customers/:external_id/wallets, which shares the schema). Defaults to the customer's billing entity.WalletUpdateInput—PUT /wallets/:id. The API permits it on update too.WalletObject— read back on every wallet response.InvoiceOneOffCreateInput—POST /invoices(one-off).The
SubscriptionCreateInput,InvoicePreviewInput,InvoiceBaseObject, andCreditNoteObjectschemas already declaredbilling_entity_codebefore this PR.Resources —
billing_entity_codes[]array query filter added to:GET /subscriptionsandGET /customers/:external_customer_id/subscriptions.GET /walletsandGET /customers/:external_customer_id/wallets.GET /payment_requestsandGET /customers/:external_customer_id/payment_requests.GET /invoicesandGET /credit_notesalready exposed the filter.Notes
No new schemas, parameters, or index entries — every edited file was already registered. The regenerated top-level
openapi.yamlpropagates the changes.SubscriptionObject.billing_entity_codeis added per the target API behaviour; theSubscriptionSerializeron the API side is part of the same in-flight work and should land together with — or just before — this PR.Verification
npm run build— redocly bundle clean.npm run test— redocly + spectral lint clean (0 errors). The 6 spectral warnings reported are pre-existing (status[],coupon_code[],account_type[], one unused component) — none introduced here. The newbilling_entity_codes[]filter is plural and bracket-suffixed so it satisfies botharray-params-pluralandarray-params-brackets.