docs(monetization): comprehensive correction pass#1004
Open
vazexqi wants to merge 4 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…y errors - index.mdx: replace 429 with 403 in two places (the policy returns 403 for every error condition including quota exhaustion). - meters.mdx: change CloudEvent example subject from "customer-id" to the subscription ULID. The policy emits subject == subscription, so the example was misleading. Add a note explaining Zuplo's convention. - monetization-policy.md: add three error-detail rows that the policy actually returns: "No key present", "Authorization Failed", "Subscription payment status is not available." - private-plans.md: clarify that PLAN_ID is a ULID id, not the plan key. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…enMeter
The programmatic create/change/cancel examples used field shapes that don't
exist in OpenMeter's API. Replace them with the actual schemas:
- create: body is { plan: { key, version }, customerId | customerKey, timing }.
There is no top-level planKey or stripeCustomerId.
- change: endpoint is POST /change, not PATCH on the subscription. Body is
{ timing, plan: { key, version } } and the response returns both current
and next subscriptions.
- cancel: body { timing } controls behavior. Show timing: "next_billing_cycle"
to match the prose description (omitting the body cancels immediately).
Also drop the /restore example; OpenMeter marked the endpoint deprecated as
of 2025-10-06. Direct readers to create a new subscription instead.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add a "Bucket monetization configuration" section to api-access.mdx covering
GET, PUT, and DELETE on /v3/metering/{bucketId}/monetization-configuration.
Document the four fields (multipleSubscriptionsEnabled, planOrder,
planSettings, maxPaymentOverdueDays) and explain how planOrder drives
upgrade/downgrade timing during plan changes.
Update monetization-policy.md's payment-grace-period section to show the
real precedence chain (customer metadata > plan metadata > bucket config >
built-in default), with a link to the new bucket configuration section.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add a "Stripe setup and billing readiness" section to api-access.mdx covering
the five real endpoints customers can use to script Stripe provisioning:
- POST /v3/metering/{bucketId}/setup/stripe (install app + default profile)
- GET /v3/metering/{bucketId}/setup/stripe (read current setup)
- POST /v3/metering/{bucketId}/setup/stripe/{stripeAppId}/billing-profile
- GET /v3/metering/{bucketId}/billing-readiness (lightweight readiness check)
- PUT /v3/metering/{bucketId}/apps/{appId} (rotate key, update metadata)
Document the test/live key-prefix validation on each. Add a tip in
stripe-integration.md pointing readers at the new section as the
script-friendly alternative to the Portal flow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fd121c0 to
61bf348
Compare
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
Follow-up to PR #1003. Brings the rest of the monetization docs into alignment with the actual implementation in
core(monetization-inbound policy),gateway-service(/v3/metering/...API), andopenmeter(TypeSpec API spec).Each commit is independently reviewable.
1. Correct error code, CloudEvent subject, and policy errors (
50c78b5d)index.mdx— replace429 Too Many Requestswith403 Forbiddenin two places. The policy returns 403 for every error condition, including quota exhaustion. Verified atcore/packages/runtime/src/policies/monetization-inbound/policy.ts(every error path usesHttpProblems.forbidden).meters.mdx— change CloudEvent examplesubjectfrom the OpenMeter generic"customer-id"placeholder to the actual subscription ULID. The policy emitssubject == subscription(both equal to the subscription ID) atpolicy.ts:454-465. Adds a note explaining the convention.monetization-policy.md— add three error rows that the policy actually returns ("No key present","Authorization Failed","Subscription payment status is not available.").private-plans.md— clarify the plan ID used in/publishand/plan-invitesis a 26-char ULID, not the human-friendlykey.2. Subscription-lifecycle API examples match OpenMeter (
43046df3)The programmatic create/change/cancel examples in
subscription-lifecycle.mdused field shapes that don't exist in OpenMeter's API. Replaced with the actual schemas fromopenmeter/api/spec/src/productcatalog/subscription.tsp:{ plan: { key, version }, customerId | customerKey, timing }. There is no top-levelplanKeyorstripeCustomerId.POST .../change, notPATCHon the subscription. Body is{ timing, plan: { key, version } }. Response returns bothcurrentandnextsubscriptions.{ timing }controls behavior. Showtiming: "next_billing_cycle"to match the prose; omitting the body cancels immediately./restoreexample. OpenMeter marked the endpoint deprecated as of 2025-10-06 (already past).3. Document bucket-level monetization configuration (
a12bd94c)The
MonetizationConfigurationAPI was entirely undocumented despite being the source of truth for upgrade/downgrade direction (planOrder) and the bucket-level payment grace period (maxPaymentOverdueDays). Adds a new section toapi-access.mdxcovering GET, PUT, and DELETE on/v3/metering/{bucketId}/monetization-configuration. Updatesmonetization-policy.md's grace-period section to show the correct precedence chain (customer metadata → plan metadata → bucket config → built-in default).4. Document Stripe setup and billing-readiness APIs (
fd121c0f)Five real Stripe-setup endpoints were not documented:
POST /v3/metering/{bucketId}/setup/stripe(install + default profile)GET /v3/metering/{bucketId}/setup/stripePOST /v3/metering/{bucketId}/setup/stripe/{stripeAppId}/billing-profileGET /v3/metering/{bucketId}/billing-readinessPUT /v3/metering/{bucketId}/apps/{appId}(with key-prefix validation)Adds a "Stripe setup and billing readiness" section to
api-access.mdx, plus a:::tipinstripe-integration.mddirecting scripted/CI users at the new section.Test plan
#bucket-monetization-configuration,#stripe-setup-and-billing-readiness,#subscription-and-payment-validation)