feat(store): KeepKey dropship live-API polling + webhook hardening#131
Merged
Conversation
Align the KeepKey dropship integration with the live API contract from the
2026-07-15 go-live handoff so live orders can be tracked and settled.
- Poll by externalOrderId: getDropshipOrderByExternalId + GET
/api/store/orders?externalOrderId=… (order.shipped webhook doesn't fire
yet, so this is the only way to learn a live order shipped). Response now
re-returns the settlement block for recovery.
- Harden webhook verification: confirmed Stripe-style
HMAC-SHA256("${t}.${rawBody}"); drop the ambiguous fallback and reject
timestamps outside a 5-min window (replay defense).
- DropshipOrderRecord carries settlement + estimatedShippingDate.
- SandboxOrderTester polls the new route and shows tracking.
- Tests: signature verification + externalOrderId lookup (server-only vitest alias).
- Docs: poll-only tracking, settlement, account_suspended, live-order checklist.
Verified end-to-end against the KeepKey sandbox (place → poll round-trip).
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
|
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
externalOrderId(KeepKey'sorder.shippedwebhook doesn't fire yet, so this is the only way to learn a live order shipped).Changes
src/services/keepkey-dropship.ts—getDropshipOrderByExternalId();verifyWebhookSignature()now single Stripe-style schemeHMAC("${t}.${rawBody}")+ rejects timestamps outside 5 min (WEBHOOK_TIMESTAMP_TOLERANCE_SECONDS).src/app/api/store/orders/route.ts— newGET /api/store/orders?externalOrderId=….src/lib/schemas/dropship.ts—DropshipOrderRecordcarriessettlement+estimatedShippingDate.src/components/store/SandboxOrderTester.tsx— polls the new route, shows tracking.src/services/keepkey-dropship.test.ts(+src/test/server-only-stub.ts, vitest alias) — 12 tests.docs/integrations/keepkey-fulfillment.md— poll-only tracking, settlement,account_suspended, live-order checklist.Test plan
pnpm test— 102 passing (12 new)pnpm lint+prettiercleanGET ?externalOrderId=poll round-trip/store/keepkey-hardware-walletGenerated with Claude Code