Create an order for a one-time product using a checkout session. After creating the order, redirect the buyer to the returned checkoutUrl to complete payment on the PSP-hosted page.
POST /v1/actions/onetime-order/create-order
Authentication: API Key
Request Body
| Field | Type | Required | Description |
|---|
checkoutSessionId | string | Yes | Checkout session ID (cs_ + UUID format) |
billingDetail | object | Yes | Final billing details for the order |
buyerEmail | string | No | Buyer’s email address |
buyerIp | string | No | Buyer’s IP address (used for tax jurisdiction) |
successUrl | string | No | Override redirect URL after successful payment |
Billing Detail Object
| Field | Type | Required | Description |
|---|
country | string | Yes | ISO 3166-1 alpha-2 country code |
isBusiness | boolean | Yes | Whether this is a business purchase |
postcode | string | No | Postal or ZIP code |
state | string | Conditional | Required for US and CA |
businessName | string | Conditional | Required when isBusiness is true |
taxId | string | Conditional | Required for EU countries when isBusiness is true |
Example Request
import { WaffoPancake } from "@waffo/pancake-ts";
const client = new WaffoPancake({
merchantId: process.env.WAFFO_MERCHANT_ID!,
privateKey: process.env.WAFFO_PRIVATE_KEY!,
});
const { checkoutUrl } = await client.orders.createOnetimeOrder({
checkoutSessionId: "cs_550e8400-e29b-41d4-a716-446655440000",
billingDetail: {
country: "US",
isBusiness: false,
state: "CA",
postcode: "94105",
},
buyerEmail: "customer@example.com",
});
// Redirect the buyer to complete payment
console.log(checkoutUrl);
Success Response
{
"data": {
"checkoutUrl": "https://checkout.waffo.ai/my-store-abc123/payment/ORDER_TOKEN"
}
}
Response Fields
| Field | Type | Description |
|---|
checkoutUrl | string | PSP-hosted payment page URL. Redirect the buyer here to complete payment. |
Errors
| Status | Message | Description |
|---|
| 400 | Missing required fields | checkoutSessionId or billingDetail is missing |
| 400 | Invalid billingDetail | Billing detail validation failed |
| 404 | Session not found | No checkout session matches the given ID |
| 404 | Session expired | The checkout session has expired |
After calling this endpoint, redirect the buyer to the checkoutUrl. The hosted payment page handles payment collection, 3D Secure authentication, and redirects back to your successUrl upon completion.