Harden Stripe limited-preview checkout and reconciliation#109
Merged
Conversation
dirtybits
marked this pull request as ready for review
July 17, 2026 06:45
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_7ef81c6b-033b-4d83-a08e-e67aca32189e) |
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.
What changed
stripe:opspreflight/monitor commandsWhy
The wallet-bound Stripe test flow worked end to end, including refund revocation, but production activation still lacked an explicit server gate, durable reconciliation, and checkout abuse controls. Base-listed skills also cannot safely redeem the legacy wallet-pubkey entitlement, so the route continues to reject them until a chain-neutral access-grant seam exists.
Verification
npm run format:checknpm run lint --workspace @agentvouch/webnpm run typecheck --workspace @agentvouch/webnpm run test --workspace @agentvouch/web— 107 files / 717 testsnpm exec --workspace @agentvouch/web -- next build --webpacknpm run stripe:ops --workspace @agentvouch/web -- preflightwith placeholder configured valuesReadywith both public and server checkout flags enabled for preview only401, proving the server checkout gate was active400cs_test_a1FXhQqfS6rTcdaWg5TnODCP8FvZvl4JafYwY7x2qisD61p72V3jOa5JSn, payment intentpi_3Tu4lNA2jEYsGvGP01cbtB2C402to200; returned content matched SHA-25699dfd32607fe61c12aeea6ec1c3c59434ab450da5b16f86a93056fbe71cee148stripe-mpp-offchainflow; protocol purchase, settlement, EVM, and x402 fields stayed null409; unrelated wallet remained402re_3Tu4lNA2jEYsGvGP0DKG17jvreturned buyer access from200to402, setrevoked_reason=stripe-refund, and preserved exactly one append-only receiptLive preview
The first read-only monitor found that a new environment has no
stripe_webhook_outcomesrelation until the first valid webhook bootstraps it. Commit590efbemakes that read-only pre-first-event state an empty queue without performing DDL. Deploymentdpl_4GQ9FUKYq7m2jT543LdzLmjQpuzzpassed the full monitor/payment/entitlement/download/refund smoke, andhttps://agentvouch-stripe-test-listing.vercel.appnow points to that verified preview artifact. Commitsceecff4and0aa6438record the evidence in the plan.Not activated
Note
Medium Risk
Touches payment checkout, webhook fulfillment/revocation, and entitlement writes; changes are gated and well-tested but errors in persistence or activation could block checkout or delay operator visibility until retries succeed.
Overview
Hardens the wallet-bound Stripe limited preview so checkout activation, fulfillment audit, and operator checks are explicit without turning card sales into protocol purchases.
Checkout vs webhooks: Session creation now requires
AGENTVOUCH_STRIPE_CHECKOUT_ENABLED(and in production,AGENTVOUCH_STRIPE_EDGE_RATE_LIMIT_READYas an acknowledgement that edge/WAF rate limiting exists). Webhooks still run when only secrets are set, so refunds, disputes, and retries can converge after checkout is turned off.Abuse controls:
POST /api/stripe/checkoutadds per-IP and per-wallet in-memory rate limits (429 +Retry-After) before DB work, as defense in depth beside the production gate.Durable reconciliation: New
stripe_webhook_outcomestable andrecordStripeWebhookOutcomepersist fulfillment, revocation, ignored, and needs-review outcomes (idempotent on Stripeevent_id, no raw payloads). The webhook path records outcomes before ACKing unprocessable events; failure to persist returns 500 so Stripe retries. Partial refunds and unmatched revocations queue for review.Operator tooling: Read-only
npm run stripe:ops(preflight/monitor) reports activation blockers and open review items; monitor treats a missing table as empty (no DDL).Docs: Stripe policy, test rollout, and feasibility docs updated for the new flags, queue, monitor, and design-only direction for walletless buyer accounts and Base off-chain access grants (not implemented here).
Reviewed by Cursor Bugbot for commit 0aa6438. Bugbot is set up for automated code reviews on this repo. Configure here.