Skip to content

🐛 GET /api/billing/plans returns every active Stripe product as a plan #4113

Description

@PierreBrisorgueil

Symptom

GET /api/billing/plans is public and returns every active Stripe product as a plan, not only the configured subscription plans. One-time products (e.g. compute packs sold through the extras endpoint) come back as plans with monthlyPrice: 0 and stripePriceMonthly: null.

Root cause

modules/billing/services/billing.plans.service.js, fetchPlansFromStripe (line ~74):

const planId = product.metadata?.planId || product.id;

A product without metadata.planId falls back to its raw Stripe product id, so anything active in the Stripe account advertises itself as a plan.

Impact

No UI defect when the pricing page selects by planId. The problem is the public API contract: a CLI, MCP client or agent that iterates this endpoint sees entries that are not plans; a checkout built from one carries a null price id.

Fix

Keep only products carrying metadata.planId and drop the raw-id fallback (the real plans already follow that convention). Add a unit test with a mixed catalogue (plan products + one-time products).

Found downstream during a QA pass; reproduces on current master.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions