fix(cursor): include Stripe customer balance in Credits#251
fix(cursor): include Stripe customer balance in Credits#251validatedev merged 4 commits intomainfrom
Conversation
Combine Cursor credit grants with Stripe customer balance so Credits reflects total available funds rather than only the active grant. Made-with: Cursor
🤖 Augment PR SummarySummary: Fixes Cursor’s Changes:
Technical Notes: The Stripe call uses a 10s timeout and treats non-2xx responses or unparsable payloads as “no Stripe balance” (non-fatal). 🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Pull request overview
Updates the Cursor provider plugin so the “Credits” metric reflects both active credit grants and any Stripe prepaid customer balance retrieved from cursor.com, aligning displayed available funds with what users can actually spend.
Changes:
- Add a
GET https://cursor.com/api/auth/striperequest (authenticated viaWorkosCursorSessionTokencookie) to fetch StripecustomerBalance. - Combine Stripe prepaid balance (negative
customerBalance) with active credit grant totals when computing the “Credits” line. - Add regression tests for combined grant+Stripe credits and Stripe-only credits, and document the new endpoint/auth details.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
plugins/cursor/plugin.js |
Fetches Stripe customer balance and combines it with grant totals to compute the Credits limit. |
plugins/cursor/plugin.test.js |
Adds test coverage for combined credits and Stripe-only credits scenarios. |
docs/providers/cursor.md |
Documents the Stripe endpoint, cookie auth pattern, and updated Credits metric source/semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Made-with: Cursor
Coerce Stripe customerBalance values to a number before validation so numeric-string responses still contribute to the Credits metric. Made-with: Cursor
Description
GET /api/auth/stripe) in the Cursor plugin using the existingWorkosCursorSessionTokensession-cookie pattern.Creditsreflects total available funds (instead of only the active grant).Related Issue
Type of Change
Testing
bun run buildand it succeededbun run testand all tests passbun tauri devnpm test -- plugins/cursor/plugin.test.js(47/47 passing)Screenshots
Checklist
mainbranchMade with Cursor
Note
Medium Risk
Adds a new call to an undocumented
cursor.comendpoint and changes credit calculations, which could affect reported balances if the endpoint/auth cookie format changes or responses are unexpected.Overview
Fixes the Cursor plugin’s Credits metric to reflect total available funds by combining
GetCreditGrantsBalancewith Stripe’scustomerBalancefromGET /api/auth/stripe(viaWorkosCursorSessionTokencookie).Adds
fetchStripeBalancewith defensive parsing (supports numeric strings, treats negative balances as credit, ignores non-2xx/invalid data), updates the Credits line to use the combined total while keeping “used” from grants when present, and adds regression tests plus provider docs for the new endpoint and cookie auth.Written by Cursor Bugbot for commit 50872b6. This will update automatically on new commits. Configure here.
Summary by cubic
Fixes the Credits metric in the Cursor plugin to include Stripe prepaid balance alongside Cursor credit grants, so it shows total available funds. Adds a session‑cookie Stripe fetch and supports numeric‑string balances.
Written for commit 5966603. Summary will update on new commits.