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 to view, copy, or download the exact
SKILL.md used by the team.Pancake CLI
Prefer no code? Install with
npm install -g @waffo/pancake-cli, then run pancake login — list products, create coupons and forward test webhooks from the terminal; every command is discoverable as JSON for agents.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
Set each currency independently inprices. Use decimal strings in the currency’s display unit, such as "29.00" for USD 29 and "4500" for JPY 4,500. When updating prices, include every currency you want to keep.
TaxCategory.Ebook for an e-book or TaxCategory.SaaS for a SaaS subscription. The remaining categories are DigitalGoods, Software, OnlineCourse, Consulting and ProfessionalService.
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
Use a database uniqueness constraint on (eventType, eventId) within the store and environment. Commit the event record together with the business change or a durable queue entry in one transaction. Return 2xx after commit, including for a duplicate whose transaction already committed. Return a failure on a storage error so the event can be delivered again. See signature verification and delivery handling in Webhooks.
Cancel Subscription
GraphQL Queries
Read-only. UseString! for ID variables (not ID!).
Webhook Verification
Read the original request body withrequest.text() in Next.js or Hono, or express.raw() before JSON middleware in Express. Pass it and X-Waffo-Signature to verifyWebhook. For a registered endpoint, pass its configured environment (test or prod). For local listener protocol 2, pass { publicKey } with the current session’s PEM from data.signingPublicKey in the NDJSON ready event. Keep the timestamp check enabled. After verification, check that the signed mode and storeId match the endpoint. See signature verification and delivery handling in Webhooks.
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
-
For local testing with listener protocol 2, sign in through the browser, start
pancake listenin Test and load the new session’s PEM into your receiver after each start. See the CLI release requirements and SDK example. To test a registered public HTTPS endpoint, you can also use a tunnel that preserves the body and signature header. -
Idempotency is opt-in — the SDK sends no key unless you pass
{ idempotencyKey }on the call. Without one a retried write executes again; with one the platform replays the first response for 24h. -
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 - For a registered endpoint, verify the raw body and signature for its configured environment, then commit the event before acknowledging it.
- Configure webhook URL:
client.webhooks.add({ storeId, channel: "http", url, events, testMode })