Skip to content

fix(payments): document the missing error statuses and correct the payment definitions - #661

Merged
groyoh merged 1 commit into
mainfrom
openapi-guardian/2026-10-19-payments
Oct 19, 2026
Merged

groyoh merged 1 commit into
mainfrom
openapi-guardian/2026-10-19-payments

Conversation

@lago-claude-ai-agent

Copy link
Copy Markdown
Contributor

Context

OpenAPI guardian check of payments (incremental run), compared with lago-api at 2d7c3c1 and the SDK clients.

Description

  • POST /payments documents 403 and 404. Recording a manual payment is refused with a forbidden error when the organization is not on a premium plan or when the invoice does not accept a manual payment, and with a not found error when the invoice does not exist.

    Code references (lago-api at 2d7c3c1)
  • GET /payments and GET /customers/{external_customer_id}/payments document 422. An invoice_id that is not a valid identifier is rejected before the query runs.

    Code references (lago-api at 2d7c3c1)
  • PaymentCreateInput.payment.invoice_id now uses format: uuid and says which invoice it points at. Lago looks the invoice up by its identifier inside the organization.

    Code references (lago-api at 2d7c3c1)
  • PaymentObject.status now says that the value is always succeeded for a manual payment, which was not obvious from a description that only talked about payment providers.

    Code references (lago-api at 2d7c3c1)
  • Wording: PaymentObject.payment_status reads as a sentence now, PaymentObject.external_customer_id was missing its final period, and the reference and paid_at descriptions of PaymentCreateInput say what the field holds and what happens when it is left out.

    Code references (lago-api at 2d7c3c1)

SDK drift (spec is right, needs an sdk-clients-update run)

Client Divergence
Go Payment has no field for lago_customer_id, lago_payable_id, payable_type, status, payment_provider_code, payment_provider_type, provider_payment_id or provider_customer_id, all of which V1::PaymentSerializer#serialize sends.
Python PaymentResponse has the same gaps and also drops external_customer_id and next_action.

Needs human confirmation (not changed)

  • PaymentObject.payment_status is documented as always present with one of four values. In lago-api the column payments.payable_payment_status allows null and Payment declares the enum with allow_nil, but no creation path that leaves it empty was found, and every payment flow reads the value right after setting it. Making the field nullable would be breaking, so nothing was changed. Can a payment be stored without that status?
Agent notes

Run: incremental since 2026-10-11, queue reason for this resource: api. Compatibility checker: WARN (advisory); nothing is breaking. Four warnings are the newly documented 403, 404 and 422 statuses, which lago-api already answers, so only their description is new. The fifth is the format: uuid added to invoice_id in the create body, an annotation on a value that already has to be a Lago invoice identifier.

The security fix that made V1::PaymentSerializer tolerate a deleted invoice or payment request was checked against the contract and needs no spec change: the customer keys stay always present because payments.customer_id is NOT NULL, and invoice_ids and invoice_numbers can now come back empty, which the spec already allows since both are plain arrays. The list filters were read side by side with PaymentsQuery: the query also supports a currency filter and a search term, which neither list endpoint passes, so the spec is right not to document them.

Deliberately not documented

  • The x402 value of PaymentObject.type and the x402 settlement object on a payment, unreleased: x402_payments.

Docs-guardian leads

  • The most recent documentation sweep reports no suspected spec issues. The sweep before it asked whether BillableMetricObject.aggregation_type is missing custom_agg. It is not: BillableMetric::AGGREGATION_TYPES marks the value as a deprecated type kept for legacy metrics that must not be documented in the public API, so the spec stays as it is. The lead is closed, not deferred.

Report-only findings from this run

  • webhooks is clean and needs no pull request. The registry, the required lists and the four keys every webhook payload carries were checked across every file in src/webhooks/ and agree with lago-api. One question came out of it: the documentation site lists add_on.created, add_on.updated, add_on.deleted, coupon.created, coupon.updated, coupon.deleted and coupon.terminated, which have no entry in config/webhook_event_types.yml and no service under app/services/webhooks/, so an endpoint cannot subscribe to them today. Pull requests docs(webhooks): Document the coupon webhooks #651 and docs(webhooks): Document the add-on webhooks #652 add exactly those files to the specification and were left untouched by this run. Will lago-api add the matching registry entries and services?

Queue

  • customers (spec+api), api_logs (spec+api), features (spec), payment_requests (spec), invoices (api), payments (api), wallets (api), organizations (api), webhooks (api). Every one was checked. activity_logs was skipped because it already has an open guardian pull request.

Deferred to next run

  • Nothing. Every resource in the queue was checked.

Run started: 2026-10-19T07:51:37Z.

Process feedback for the retro

  • The two settled rulings for this resource, the short provider enum on payment_provider_type and format: date on paid_at, were both still correct and cost nothing to skip. The settled list works well when it names the exact field.
  • Two resources this run were queued on an lago-api change that never reached a serializer, a permitted parameter list or a route, so neither could produce a spec change. Filtering the queue on that condition would free checking capacity.
  • The three standard webhook checks are fully mechanical. They would be cheaper and more reliable as a script committed to this repository than as a task repeated by hand each sweep.

A human must review and merge this PR; the agent never merges. (Remove this line from the squash commit message.)

@groyoh
groyoh merged commit a476849 into main Oct 19, 2026
3 checks passed
@groyoh
groyoh deleted the openapi-guardian/2026-10-19-payments branch October 19, 2026 13:28
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.

1 participant