Skip to main content

Create Checkout Session

Create a checkout session that locks product version, pricing, and currency. This is the first step in the checkout flow for both one-time and subscription products.
POST /v1/actions/checkout/create-session
Authentication: API Key or Store Slug

Request Body (API Key)

FieldTypeRequiredDescription
storeIdstringYesUUID of the store
productIdstringYesUUID of the product
productTypestringYesonetime or subscription
currencystringYesISO 4217 currency code
withTrialbooleanNoEnable trial period (subscriptions only)
buyerEmailstringNoPre-fill buyer’s email
billingDetailobjectNoPre-fill billing details
successUrlstringNoOverride redirect URL on success
expiresInSecondsnumberNoCustom session TTL
metadataobjectNoCustom key-value data
priceSnapshotobjectNoOverride pricing (API Key only)

Request Body (Store Slug)

FieldTypeRequiredDescription
productIdstringYesUUID of the product
productTypestringYesonetime or subscription
currencystringYesISO 4217 currency code
billingDetailobjectNoPre-fill billing details
buyerEmailstringNoPre-fill buyer’s email
withTrialbooleanNoEnable trial period
successUrlstringNoOverride redirect URL
metadataobjectNoCustom key-value data
Store Slug authentication does not support priceSnapshot to prevent price tampering from the client side.

Example Request

import { WaffoPancake, CheckoutSessionProductType } from "@waffo/pancake-ts";

const client = new WaffoPancake({
  merchantId: process.env.WAFFO_MERCHANT_ID!,
  privateKey: process.env.WAFFO_PRIVATE_KEY!,
});

const session = await client.checkout.createSession({
  storeId: "store-uuid",
  productId: "product-uuid",
  productType: CheckoutSessionProductType.Onetime,
  currency: "USD",
  buyerEmail: "customer@example.com",
  successUrl: "https://example.com/thank-you",
});
// => session.checkoutUrl, session.sessionId, session.expiresAt

Success Response

{
  "data": {
    "sessionId": "session-uuid",
    "checkoutUrl": "https://checkout.waffo.ai/store-slug/checkout/session-uuid",
    "expiresAt": "2026-01-22T10:30:00.000Z"
  }
}
Checkout sessions have a 7-day TTL. The session locks the product version and pricing at creation time, so price changes won’t affect existing sessions.

Preview Tax

Preview tax calculation for a checkout session before creating the order.
POST /v1/actions/checkout/preview-tax
Authentication: Store Slug

Request Body

FieldTypeRequiredDescription
checkoutSessionIdstringYesUUID of the checkout session
billingDetailobjectYesBilling details for tax calculation

Billing Detail

FieldTypeRequiredDescription
countrystringYesISO 3166-1 alpha-2 country code
isBusinessbooleanYesWhether this is a business purchase
statestringConditionalRequired for US, CA
businessNamestringNoBusiness name
taxIdstringNoTax ID (for EU B2B exemption)

Success Response

{
  "data": {
    "subtotal": 2900,
    "taxAmount": 261,
    "total": 3161,
    "taxRate": 0.09
  }
}

Create One-Time Order

Create an order for a one-time product using a checkout session.
POST /v1/actions/onetime-order/create-order
Authentication: API Key

Request Body

FieldTypeRequiredDescription
checkoutSessionIdstringYesUUID of the checkout session
billingDetailobjectYesBilling details
buyerEmailstringNoBuyer’s email address
buyerIpstringNoBuyer’s IP address (for tax calculation)
successUrlstringNoOverride redirect URL on success

Billing Detail

FieldTypeRequiredDescription
countrystringYesISO 3166-1 alpha-2 country code
isBusinessbooleanYesWhether this is a business purchase
statestringConditionalRequired for US, CA
postcodestringNoPostal/ZIP code
businessNamestringNoBusiness name (when isBusiness: true)
taxIdstringNoTax ID (required for EU B2B)

Example Request

curl -X POST https://waffo-pancake-auth-service.vercel.app/v1/actions/onetime-order/create-order \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
  -d '{
    "checkoutSessionId": "session-uuid",
    "billingDetail": {
      "country": "US",
      "isBusiness": false,
      "state": "CA",
      "postcode": "94105"
    },
    "buyerEmail": "customer@example.com"
  }'

Success Response

{
  "data": {
    "checkoutUrl": "https://checkout.waffo.ai/store-slug/checkout/token"
  }
}
Redirect the buyer to checkoutUrl to complete payment. The checkout page handles payment collection, tax calculation, and 3D Secure authentication.

Cancel One-Time Order

Cancel a pending (unpaid) order.
POST /v1/actions/onetime-order/cancel-order
Authentication: API Key

Request Body

FieldTypeRequiredDescription
orderIdstringYesUUID of the order to cancel

Success Response

{
  "data": {
    "orderId": "order-uuid",
    "status": "canceled"
  }
}
Only orders with pending status can be canceled. Completed orders require a refund request instead.

One-Time Order Status Values

StatusDescription
pendingOrder created, payment not yet completed
completedPayment successful, order fulfilled
canceledOrder canceled before payment