The Simple Version
Tell your AI assistant:SKILL.md.
The Full Version
For a complete integration with end-to-end tests:Official Waffo Pancake Skill
Open the official skill file from the AI Integration page to view, copy, or download the exact
SKILL.md used by the team.The
@waffo/pancake-ts SDK is the official server-side TypeScript client for the Waffo Pancake API. It handles request signing, checkout session creation, webhook verification, and GraphQL queries.
AI Coding Workflow
AI coding agents are most useful when you already understand the business model but want help turning it into a clean Waffo catalog and implementation plan. Typical tasks:- Convert a pricing page into Waffo products and product groups
- Decide which offers should be subscription products vs one-time charges
- Design dynamic pricing flows with
priceSnapshot - Batch-generate product definitions, metadata, and rollout checklists
- Review an existing catalog for naming, plan structure, and production readiness
Recommended Workflow
1
Describe the business model
Explain what you sell, how customers are charged, and which parts are fixed-price versus usage-based.
2
Ask for a catalog plan
Have the agent map your offers into one-time products, subscription products, product groups, and optional dynamic pricing flows.
3
Review the output
Confirm naming, billing periods, tax categories, and whether any add-ons should remain one-time charges.
4
Implement
Use the output to create products in the Dashboard or to generate SDK/API integration code.
Prompt Templates
1. Turn a Pricing Page into Waffo Products
2. Plan Dynamic Pricing
3. Review an Existing Catalog
Practical Rules
It is normal for a subscription-led business to create both subscription products and one-time charges. The charging model should match the business event, not the company label.
What To Avoid
- Do not paste private keys or production secrets into prompts
- Do not let an AI agent publish products to production without review
- Do not model every pricing variation as a separate product if the final amount is computed at runtime
- Do not force overage billing into subscription products when the charge is event-based
Gotchas — Read This First
These are the mistakes that break integrations. Read before writing any code.Use Cases
Waffo Pancake is a merchant-of-record payment platform. The SDK fits projects that need:- SaaS subscription billing — monthly/yearly plans with upgrade/downgrade (e.g., Free/Pro/Team tiers)
- Digital product sales — one-time purchases for e-books, templates, courses, licenses
- Per-usage payments — charge per download, API call, or generated report
- Hybrid models — subscriptions + one-time purchases combined
Installation & Setup
WAFFO_MERCHANT_ID means your Merchant ID, not storeId and not a store identifier from a URL. storeId is still part of the current API model for store and product management flows, so do not confuse the two.
For the first working integration, only these two env vars need to exist: WAFFO_MERCHANT_ID and WAFFO_PRIVATE_KEY. Store IDs and Product IDs are runtime values you can keep in code, app config, or your own database.
PEM Key Handling
Escaped newlines (simplest):Quick Start: Path A
Quick Start: Path B
If products already exist in the Dashboard, copy the Product ID and go straight to checkout. In this flow, you still only need the same two env vars above:API Reference
Stores
One-Time Products
digital_goods | saas | software | ebook | online_course | consulting | professional_service
Subscription Products
Subscription Product Groups
Groups enable shared trials and plan switching between subscription products.Checkout Sessions
Order-Level Parameters & Priority
Parameters passed tocreateSession can override product-level settings. Understanding the priority hierarchy is essential for AI integrations:
Webhook Integration Notes
Key points to keep in mind when integrating webhooks:
Typical webhook handler pattern:
Cancel Subscription
GraphQL Queries
Read-only. UseString! for ID variables (not ID!).
Webhook Verification
The SDK embeds public keys for both environments. Verification is one function call.Next.js App Router
Express
Hono
Verification Options
Event Types
Event Shape
Configuring Webhook URLs
A store can have multiple webhooks, each delivering to a different channel (http, feishu, discord, telegram, slack). Register one entry per channel and environment:
Store.storeWebhooks field — it is the only query entry point.
Error Handling
errors[0] is the root cause (deepest layer), errors[n] is the outermost caller.
Development Tips
- Webhook tunneling — use
cloudflared, not localtunnel (see Gotchas).
-
Idempotency is automatic — the SDK generates deterministic keys from
merchantId + path + body. Retries are safe. -
Test → Prod workflow — products default to test. Use
.publish()to promote. Webhook events includemode: "test" | "prod"so your handler can distinguish.
Dashboard UI Glossary
The Dashboard supports English, Chinese, and Japanese. When docs reference a Dashboard location (e.g. “go to Integration”), the label may differ by language. Use this table to find the right menu item.Navigation
Key Fields
Modes & Actions
Product & Billing
Statuses
Where to Find IDs
Quick Start Checklist
npm install @waffo/pancake-ts- Set
WAFFO_MERCHANT_IDandWAFFO_PRIVATE_KEYenv vars (see “Where to Find IDs” above) - Initialize
new WaffoPancake({ merchantId, privateKey }) - Create or reference a store
- If the merchant has multiple stores, confirm which store should own the product(s)
- Create or reference product(s)
- Create checkout:
client.checkout.createSession(...)→ redirect tocheckoutUrl - Test with card
4576750000000110(success) or4576750000000220(declined) in sandbox - Handle webhooks:
verifyWebhook(rawBody, sig)— must userequest.text() - Configure webhook URL:
client.webhooks.add({ storeId, channel: "http", url, events, testMode })