CHW-1401 PlanFeatureRequired
this feature is not included in your current plan; upgrade the organization plan to continue
Default message: this feature is not included in your current plan; upgrade the organization plan to continue
HTTP status:402(client)
Reason:PLAN_UPGRADE_REQUIRED
Problem. A plan-gated endpoint (Billy, SSO, SCIM, SIEM) rejected the
caller. Cause. The org’s currently-assigned plan does not include the
feature the endpoint requires — the pricing_plans.features JSON has the
flag set to false (or missing). Fix. Ask an org owner to upgrade
the organization to a plan that includes the feature via
/api/billing/checkout; downgrade-to-free orgs lose gated features
immediately. HTTP 402.
Response fields. The 402 envelope carries error.fields.feature (the
gated feature key, e.g. sso) and error.upgrade_url
(https://chain305.com/pricing) so a client can render an upgrade CTA that
points at the pricing page without hard-coding the URL. upgrade_url is
omitempty and appears only on plan-gate 402s — every other CHW code’s
envelope is unchanged.
Adding a gated feature (recipe). No new CHW code is needed; every plan gate reuses CHW-1401:
- Call
b.RequirePlanFeature(w, r, "<feature_key>")at the top of the handler and early-return when it reportsfalse. - Seed the boolean flag into
pricing_plans.featuresfor each tier that grants it (migrate_seed.go). - Add the key to the recognised-flags doc comment on the billing API’s plan-features handler.