Skip to content

[ING-70] feat(multi-entity): billing_entity scoping across endpoints#546

Merged
mariohd merged 1 commit into
mainfrom
ING-70-multi-billing-entity
Jun 26, 2026
Merged

[ING-70] feat(multi-entity): billing_entity scoping across endpoints#546
mariohd merged 1 commit into
mainfrom
ING-70-multi-billing-entity

Conversation

@mariohd

@mariohd mariohd commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

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:

  • SubscriptionUpdateInputPUT /subscriptions/:external_id. Mutable, takes effect on future invoices.
  • SubscriptionObject — read back on every subscription response.
  • WalletCreateInputPOST /wallets (also covers POST /customers/:external_id/wallets, which shares the schema). Defaults to the customer's billing entity.
  • WalletUpdateInputPUT /wallets/:id. The API permits it on update too.
  • WalletObject — read back on every wallet response.
  • InvoiceOneOffCreateInputPOST /invoices (one-off).

The SubscriptionCreateInput, InvoicePreviewInput, InvoiceBaseObject, and CreditNoteObject schemas already declared billing_entity_code before this PR.

Resources — billing_entity_codes[] array query filter added to:

  • GET /subscriptions and GET /customers/:external_customer_id/subscriptions.
  • GET /wallets and GET /customers/:external_customer_id/wallets.
  • GET /payment_requests and GET /customers/:external_customer_id/payment_requests.

GET /invoices and GET /credit_notes already exposed the filter.

Notes

No new schemas, parameters, or index entries — every edited file was already registered. The regenerated top-level openapi.yaml propagates the changes.

SubscriptionObject.billing_entity_code is added per the target API behaviour; the SubscriptionSerializer on 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 new billing_entity_codes[] filter is plural and bracket-suffixed so it satisfies both array-params-plural and array-params-brackets.

## 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.
@mariohd mariohd requested review from a team, lovrocolic and toommz and removed request for a team June 24, 2026 12:12
@mariohd mariohd merged commit 198a8c2 into main Jun 26, 2026
3 checks passed
@mariohd mariohd deleted the ING-70-multi-billing-entity branch June 26, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants