Skip to main content

Create Subscription Order

Create a subscription order using a checkout session. Requires a checkout session created via Create Checkout Session.
POST /v1/actions/subscription-order/create-order
Authentication: API Key

Request Body

FieldTypeRequiredDescription
checkoutSessionIdstringYesUUID of the checkout session
billingDetailobjectYesBilling details (see below)
buyerEmailstringNoBuyer’s email address
buyerIpstringNoBuyer’s IP address
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/subscription-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 session locks the product version, pricing, and currency at creation time.

Cancel Subscription

Cancel an active subscription. The subscription enters canceling status and remains active until the end of the current billing period, when it transitions to canceled.
POST /v1/actions/subscription-order/cancel-order
Authentication: API Key

Request Body

FieldTypeRequiredDescription
orderIdstringYesUUID of the subscription order

Example Request

curl -X POST https://waffo-pancake-auth-service.vercel.app/v1/actions/subscription-order/cancel-order \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY_TOKEN" \
  -d '{"orderId": "subscription-order-uuid"}'

Success Response

{
  "data": {
    "orderId": "subscription-order-uuid",
    "status": "canceling"
  }
}
The subscriber retains access until the end of the current billing period. The status changes from canceling to canceled when the period ends. No further charges will be made.

Change Product

Change a subscription to a different product (upgrade/downgrade).
POST /v1/actions/subscription-order/change-product
Authentication: API Key
This endpoint is not yet implemented (returns 501). It will be available in a future release.

Request Body

FieldTypeRequiredDescription
orderIdstringYesUUID of the current subscription order
targetProductIdstringYesUUID of the target subscription product

Reactivate Subscription

Reactivate a canceled subscription.
POST /v1/actions/subscription-order/reactivate-order
Authentication: API Key
This endpoint is not yet implemented (returns 501). It will be available in a future release.

Request Body

FieldTypeRequiredDescription
orderIdstringYesUUID of the subscription order
productNamestringYesProduct name for confirmation

Subscription Status Values

StatusDescription
pendingSubscription created, awaiting first payment
activeActive and billing normally
trialingIn free trial period
cancelingCancellation requested, active until period end
past_duePayment failed, retrying
canceledSubscription ended, no further billing
expiredSubscription expired