Repository navigation
feat(agent): API credit top-ups; remove the Starter plan - #1252
Merged
Merged
Conversation
Settings > API keys now shows the prepaid credit balance and lets Pro, Max, and Team accounts buy credits with a card (Stripe) or Bitcoin (Zaprite), matching Research's API credits settings: $20/$50/$100/$500 packages or a custom $10-$1,000 amount. Checkout opens in the system browser and returns to the hosted web app, as Research's desktop build does; the billing service credits the account from the provider webhook, so no desktop callback or deep link is needed. Guests pay with Bitcoin. The Billing plan list now only offers Pro, Max, and Team, so the deprecated Starter product is never listed even when the products API returns it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016CZNsmxzRaVTcRMiJ5m6hq
Checkout feedback in Settings > API keys > API credits now appears directly under the pay buttons. Before, it sat below the purchase card, where it could fall past the bottom of the window. When the balance cannot load, the host logs the billing error and the section shows a short message under the last known balance, instead of the raw error text in place of the number. A failed Refresh now shows this message too. Guests now see Pay with card disabled with a tooltip, as on the web, instead of no card button at all. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Starter is no longer sold and no account is on it, so PlanTier no longer has a Starter variant. The Billing plan list still shows only Pro, Max and Team. Any other product name reads as Free. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
API credit top-ups (Settings → API keys → API credits), modeled on Research's
ApiCreditsSection:GET /v1/maple/api-credits/balance) with a Refresh button.POST /v1/maple/api-credits/purchase(Stripe). Pay with Bitcoin callsPOST /v1/maple/api-credits/purchase-zaprite, which sends nocancel_url, the same as Research. The checkout URL opens in the system browser through the existing https-onlyopen_in_browser.Callback / return URL (no deep links): the success URL is
{WEB_URL}/?credits_success=trueand the Stripe cancel URL is{WEB_URL}/. These are new profile constantsCREDITS_SUCCESS_URLandCREDITS_CANCEL_URL. Research's desktop (Tauri) build already uses exactly these, withapp.maple.aiorapp-dev.maple.aiby billing environment. Only Research mobile uses universal links. The billing service credits the account from the Stripe/Zaprite webhook, so the redirect only affects what the browser shows: the web app's home route sends a signed-in user to/settings/apiwith the success banner. The desktop app just re-reads the balance when you press Refresh; it doesn't poll.Plans: the app no longer models Starter.
PlanTieris Free, Pro, Max or Team. The Billing plan list keeps only Pro, Max and Team products (PlanTier::is_for_sale). Free and any product name the app doesn't recognize are never listed.Plumbing:
maple-billinggetsPaymentMethod,CreditPurchaseRequest,credit_checkout_url, and the purchase limits. There are two new host operations,api_credit_balanceandpurchase_api_credits. Both are local-only: they are added to the wire test that asserts they are not remote commands.Validation
just cipasses locally on macOS with the follow-up commit: fmt, all four clippy passes, and the workspace and headless tests.http://checkout link is refused by the https-only opener, as intended. The notice shows under the buttons.Generated by Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.