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 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
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

taxCategory options: 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 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, dynamic coupon discounts, A/B testing different price points, and more.

Webhook Integration Notes

Key points to keep in mind when integrating webhooks: Typical webhook handler pattern:

Cancel Subscription

GraphQL Queries

Read-only. Use String! 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:
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. Webhook tunneling — use cloudflared, not localtunnel (see Gotchas).
  1. Idempotency is automatic — the SDK generates deterministic keys from merchantId + path + body. Retries are safe.
  2. 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. Handle webhooks: verifyWebhook(rawBody, sig)must use request.text()
  10. Configure webhook URL: client.webhooks.add({ storeId, channel: "http", url, events, testMode })