Create a subscription order using a checkout session. Requires a session created via Create Checkout Session with productType: "subscription".
POST /v1/actions/subscription-order/create-order
Authentication: API Key
Request Body
| Field | Type | Required | Description |
|---|
checkoutSessionId | string | Yes | Checkout Session ID (cs_ + UUID format) |
billingDetail | object | Yes | Billing details for tax calculation |
buyerEmail | string | No | Buyer’s email address |
buyerIp | string | No | Buyer’s IP address (for tax calculation) |
successUrl | string | No | Override redirect URL on success |
Billing Detail
| Field | Type | Required | Description |
|---|
country | string | Yes | ISO 3166-1 alpha-2 country code |
isBusiness | boolean | Yes | Whether this is a business purchase |
state | string | Conditional | Required for US, CA |
postcode | string | No | Postal/ZIP code |
businessName | string | Conditional | Required when isBusiness: true |
taxId | string | Conditional | Tax ID (required for EU B2B exemption) |
Example Request
const { checkoutUrl } = await client.orders.createSubscriptionOrder({
checkoutSessionId: "cs_550e8400-e29b-41d4-a716-446655440000",
billingDetail: {
country: "US",
isBusiness: false,
state: "CA",
postcode: "94105",
},
buyerEmail: "customer@example.com",
});
// Redirect buyer to checkoutUrl
Success Response (200)
{
"data": {
"checkoutUrl": "https://waffo.ai/store/my-store/checkout/token"
}
}
Response Fields
| Field | Type | Description |
|---|
checkoutUrl | string | Redirect URL for the buyer to complete payment |
Redirect the buyer to checkoutUrl to complete payment. The checkout page handles payment collection, tax calculation, and 3D Secure authentication. The session locks the product version, pricing, and currency.
Error Responses
| Status | Description |
|---|
| 400 | Missing required fields / invalid billing detail |
| 401 | Authentication failed |
| 404 | Checkout session not found or expired |
| 500 | Internal server error |