Payments (Waffo Pancake)
This marketing site sells one-time commercial licenses through Waffo Pancake using @waffo/pancake-ts.
What is wired up
Section titled “What is wired up”| Piece | Path |
|---|---|
| Checkout session API | POST /api/checkout → functions/api/checkout.ts |
| Webhook receiver | POST /api/webhooks/waffo → functions/api/webhooks/waffo.ts |
| License lookup | POST /api/licenses/lookup → functions/api/licenses/lookup.ts |
| Pricing CTAs | Currently link to Contact (checkout UI not mounted) |
| Thanks / redeem | /thanks and /zh/thanks |
| Agent skill | .agents/skills/waffo-pancake/SKILL.md |
Checkout opens in a new tab (window.open) per Waffo guidance. Webhooks verify RSA signatures with verifyWebhook(rawBody, signature) — the body must be raw text.
Environment variables
Section titled “Environment variables”Set in .env (local) and Cloudflare Pages secrets (production):
WAFFO_MERCHANT_ID=WAFFO_PRIVATE_KEY= # or WAFFO_PRIVATE_KEY_BASE64=WAFFO_PRODUCT_STANDARD= # one-time Product ID (Standard $199)WAFFO_PRODUCT_PRO= # one-time Product ID (Pro $299)WAFFO_STORE_ID= # optional; used by seed scriptWAFFO_WEBHOOK_ENVIRONMENT=test # or prodSITE_URL=https://your-domain.comAlso bind a KV namespace as LICENSES (see wrangler.jsonc) so order.completed events persist for lookup.
Create products
Section titled “Create products”- Sign in to the Waffo Dashboard.
- Create (or select) a store.
- Create two one-time products (
digital_goods/software), e.g.$199and$299USD. - Copy Product IDs into
WAFFO_PRODUCT_STANDARD/WAFFO_PRODUCT_PRO. - Or run
pnpm run seed:waffoafter setting merchant credentials.
Publish products before going live (.publish() or Dashboard Live mode).
Register the webhook
Section titled “Register the webhook”Point an HTTP webhook at:
https://your-domain.com/api/webhooks/waffoEvents: at least order.completed.
Locally use ngrok (not localtunnel) so X-Waffo-Signature is preserved:
ngrok http 4321Test cards
Section titled “Test cards”Success: 4576 7500 0000 0110
Declined: 4576 7500 0000 0220
Any future expiry / CVC.
Fulfillment flow
Section titled “Fulfillment flow”- Buyer clicks Buy →
POST /api/checkout→ Waffo hosted checkout. - After payment, Waffo redirects to
/thanks(or/zh/thanks). - Webhook
order.completedstores the purchase in KV keyed by email + order id. - Buyer can look up purchases on the thanks page; deliver source access (private repo invite / download) manually or via your email provider.