Skip to content

0.1.8: Lock down the example app and fix README drift - #80

Open
michaelshimeles wants to merge 1 commit into
fix/customer-lookupsfrom
fix/example-auth-and-docs
Open

michaelshimeles wants to merge 1 commit into
fix/customer-lookupsfrom
fix/example-auth-and-docs

Conversation

@michaelshimeles

Copy link
Copy Markdown
Collaborator

Third of five stacked PRs, and the last one in the 0.1.8 patch. Based on the customer lookups PR.

What changed

  • The example's linkSubscriptionToOrg was a public mutation with no auth check. Any caller could set userId on any subscription, which then passed the ownership checks in cancelSubscription, reactivateSubscription, and updateSeats, so they could cancel someone else's subscription. It's removed, along with getCustomerData, getSubscriptionInfo, and getOrgPayments, which the app never called and which returned billing data for any ID.
  • getOrgSubscription and getOrgInvoices now require sign-in and only return billing the signed-in user bought. The demo has no org membership to check against, and a comment says to check membership in a real app.
  • The package exports vCustomer, vSubscription, vCheckoutSession, vPayment, and vInvoice. The example's hand-written returns validators were missing cancelAt, so any subscription scheduled to cancel failed validation at runtime. The example uses the exported validators now.
  • The portal action looks up the user's customer first, and the team checkout uses getAppUrl() for its cancel URL.
  • README fixes:
    • payment_intent.payment_failed is no longer listed as handled, since it never was.
    • invoice.payment_failed is described accurately.
    • Every public query and mutation is listed.
    • The missing schema fields are added.
    • The clone URL is fixed.
    • A note warns that component queries return data for any ID you pass.
  • The README also gets one Prettier pass. It was already unformatted on main, which is most of the line count here.

Testing

  • npm run build, npm test (63 passing), npm run typecheck (covers the example app), npm run lint.
  • npx convex dev --once against a local anonymous deployment deploys the example and the component cleanly.

- Remove the example's unauthenticated linkSubscriptionToOrg mutation,
  which let any caller set userId on any subscription and then pass the
  ownership checks in cancelSubscription and updateSeats. Also remove
  getCustomerData, getSubscriptionInfo, and getOrgPayments, which the app
  never used and which returned billing data without checking the caller.
- getOrgSubscription and getOrgInvoices require sign-in and only return
  billing the caller purchased, since the demo has no org membership.
- Export vCustomer, vSubscription, vCheckoutSession, vPayment, and
  vInvoice. The example's hand-written returns validators were missing
  cancelAt, so a subscription scheduled to cancel failed validation.
- The portal action looks up the user's customer directly, and the team
  checkout uses getAppUrl() for its cancel URL.
- README: drop payment_intent.payment_failed (never handled), describe
  invoice.payment_failed accurately, list every public query and
  mutation, add missing schema fields, fix the clone URL, and run
  Prettier over the file.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pkg-pr-new

pkg-pr-new Bot commented Nov 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@convex-dev/stripe@80

commit: bdc9d87

@michaelshimeles
michaelshimeles marked this pull request as ready for review November 3, 2026 22:01
@michaelshimeles
michaelshimeles added this pull request to stack #83 November 3, 2026 22:02

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant