Skip to content

Fix admin Create $20 checkout button to call checkout session API and show UX feedback#322

Merged
GsCommand merged 1 commit into
mainfrom
codex/fix-create-20-checkout-button
May 24, 2026
Merged

Fix admin Create $20 checkout button to call checkout session API and show UX feedback#322
GsCommand merged 1 commit into
mainfrom
codex/fix-create-20-checkout-button

Conversation

@GsCommand
Copy link
Copy Markdown
Contributor

Motivation

  • The admin "Create $20 checkout" action in the claim detail UI for cards_published claims was not wired to a proper frontend function and did not create Stripe checkout sessions or surface errors to the operator.
  • The change is intended to ensure the admin UI posts { claimId } to the backend POST /api/admin/create-checkout-session, shows loading state, and renders success and error information inline.

Description

  • Replaced the previous no-op checkout call with a new createCheckoutSession(claimId) function that posts { claimId } to POST /api/admin/create-checkout-session, guards for missing claimId, and sets s.checkoutLoading/s.checkoutUrl state for UI feedback.
  • Render logic updated so the checkout button shows Creating checkout... and is disabled while the request is in flight, and a success panel appears with Open checkout and Copy checkout URL when a URL is returned.
  • Error rendering added to surface API and runtime failures inline in <status> — <error> format (no alert()), and the frontend accepts checkoutUrl or url from the API (prefers checkoutUrl).
  • Ensured buttons created by JS are type="button" to avoid unintended form submissions and fixed copy button wiring for the returned checkout URL.
  • File changed: public/admin/claims.html (frontend only).

Testing

  • Ran npm test in the repo and the full suite passed (103 tests, all passing), including coverage for admin checkout-related behaviors such as unauthorized/unauthenticated checks and cards_published checkout creation.
  • Ran cd examples/webhook-auto-verify && npm run check and the example checks passed successfully.

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
commandlayer-commandlayer-org Ready Ready Preview, Comment May 24, 2026 12:32am
commandlayer-org Ready Ready Preview, Comment May 24, 2026 12:32am
commandlayer-org111 Ready Ready Preview, Comment May 24, 2026 12:32am

Request Review

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant