feat(store): USDC-on-Base checkout for KeepKey wallet#132
Merged
Conversation
Build the customer-facing checkout so a KeepKey can actually be purchased — the missing left side of the fulfillment flow. - /store/[slug]/checkout: shipping form → payment → order → confirmation with live status polling (GET /api/store/orders?externalOrderId=…). - POST /api/store/checkout is the payment gate. Sandbox mode skips payment and places a free KK-TEST-001 order (full UX testable now); live mode requires a USDC-on-Base txHash, re-verified server-side (recipient, token, amount ≥ price, confirmations, success) before forwarding to KeepKey. - externalOrderId is derived from the payment tx hash → one payment can only ever place one order (KeepKey dedupes on externalOrderId). - Checkout eligibility gated to DROPSHIP_CATALOG_SKUS (KK-HW-001 only). The tees carry a keepkey provider but are print-on-demand elsewhere → stay "coming soon" on the CTA, page, and API. - Payment via useUsdcPayment() (thirdweb, honors EOA/SA view mode). Recipient is a dedicated store wallet: NEXT_PUBLIC_STORE_CHECKOUT_ADDRESS. - i18n EN + PT-BR; tests for payment verification + eligibility (115 passing). - Docs: store-checkout.md marked Phase 1 built; keepkey-fulfillment.md + INDEX updated. Verified in sandbox end-to-end: Buy now → form → order → poll; tee correctly rejected (API 400, page 404, CTA disabled); wallet regression green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Hardcode the dedicated store wallet (0x8Bf5941d27176242745B716251943Ae4892a3C26) as STORE_CHECKOUT.recipient, matching the treasury pattern (env override wins). Public address, safe to commit; KeepKey tokens/secrets stay in env. Only used in live mode — sandbox skips payment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
KK-TEST-001order, so the full UX is testable now with no money.NEXT_PUBLIC_STORE_CHECKOUT_ADDRESS), not the treasury.Flow
/store/[slug]→ Buy now →/store/[slug]/checkout(form) →POST /api/store/checkout→ (live: verify USDC tx) →createDropshipOrder→ confirmation with status polled viaGET /api/store/orders?externalOrderId=….Changes
src/app/[locale]/store/[slug]/checkout/page.tsx— checkout route.src/components/store/CheckoutFlow.tsx— form + payment + confirmation/status polling.src/hooks/use-usdc-payment.ts— USDC transfer on Base (thirdweb, honors EOA/SA view mode).src/app/api/store/checkout/route.ts— payment gate → fulfillment order.src/services/store-payment.ts— on-chain payment verification (+ tests).src/lib/store/fulfillment.ts— checkout eligibility (KK-HW-001only; tees stay "coming soon") (+ tests).src/lib/schemas/checkout.ts,src/lib/config.ts(STORE_CHECKOUT), CTA wiring inProductDetail.tsx.env.example; docs (store-checkout.md,keepkey-fulfillment.md,INDEX.md).Security notes
verifyUsdcPayment). No client-reported payment is trusted.externalOrderId = gnars-<txHash>+ KeepKey dedup → one payment cannot place two orders.Test plan
pnpm test— 115 passing (13 new: payment verification + eligibility)pnpm lint+prettierclean, notscsrc errorsreceived)unsupported_product, page 404, CTA disabledNEXT_PUBLIC_STORE_CHECKOUT_ADDRESS+ flipKEEPKEY_DROPSHIP_MODE=live, then do one real orderGenerated with Claude Code