Skip to main content

The Simple Version

Tell your AI assistant:
That’s it. Use this page as the AI integration entry point, then open the official skill file below when you need the exact 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
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

Server-side only. Node.js 18+. Zero dependencies.
Two env vars are required — provided at signup:
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):
Base64 (recommended for CI/CD):
File path (local dev):

Quick Start: Path A

Store IDs and Product IDs are follow-up values. Save them wherever your app keeps runtime configuration; they do not need to be env vars unless you want that convention. If a merchant has multiple stores, confirm which store should own the product before creating it. Do not guess the target store.

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 in prices. 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.
Choose the SDK tax category for what you sell, for example 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 to createSession can override product-level settings. Understanding the priority hierarchy is essential for AI integrations:
priceSnapshot is the key parameter for dynamic pricing. When priceSnapshot is provided, the price set on the product is completely ignored. Use cases include: usage-based tiered pricing, A/B testing different price points, and more. Do not use it for discounts — create a coupon and apply it with couponId, promotionCode or allowPromotionCodes, so uses and limits are tracked and the customer sees the discount (see Discounts & Promotions).A server-side checkout can override the price for this session with priceSnapshot. Its amount uses the session’s currency, and taxCategory describes the product. For a subscription, the override applies to its regular price. Any trial price comes from the product version.

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. Use String! for ID variables (not ID!).

Webhook Verification

Read the original request body with request.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:
To list webhooks, use the GraphQL Store.storeWebhooks field — it is the only query entry point.

Error Handling

Errors are ordered by call stack depth: errors[0] is the root cause (deepest layer), errors[n] is the outermost caller.

Development Tips

  1. For local testing with listener protocol 2, sign in through the browser, start pancake listen in 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.
  2. 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.
  3. Test → Prod workflow — products default to test. Use .publish() to promote. Webhook events include mode: "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.

Key Fields

Modes & Actions

Product & Billing

Statuses

Where to Find IDs


Quick Start Checklist

  1. npm install @waffo/pancake-ts
  2. Set WAFFO_MERCHANT_ID and WAFFO_PRIVATE_KEY env vars (see “Where to Find IDs” above)
  3. Initialize new WaffoPancake({ merchantId, privateKey })
  4. Create or reference a store
  5. If the merchant has multiple stores, confirm which store should own the product(s)
  6. Create or reference product(s)
  7. Create checkout: client.checkout.createSession(...) → redirect to checkoutUrl
  8. Test with card 4576750000000110 (success) or 4576750000000220 (declined) in sandbox
  9. For a registered endpoint, verify the raw body and signature for its configured environment, then commit the event before acknowledging it.
  10. Configure webhook URL: client.webhooks.add({ storeId, channel: "http", url, events, testMode })