Builds a Kapruka order from the supplied cart + recipient + delivery + sender,
then returns a checkout URL the customer opens in a browser to complete payment.
No Kapruka account is required. Prices are locked for the lifetime of the link
(60 minutes) — the customer pays exactly the quoted grand total even if the
catalog price changes meanwhile.
Free public tier limits: 30 orders per hour per client IP. Cart up to 30 items,
quantity up to 99 per item. A fresh idempotency key is generated per call so
retries on transient errors return the same checkout URL rather than duplicates.
Args:
params (CreateOrderInput):
- cart (list[CartItem]): 1–30 items. Each: product_id, quantity (default 1), optional icing_text (cakes only).
- recipient (Recipient): name + phone (E.164 +9477… or local 077…)
- delivery (Delivery): address, city (must be Kapruka-deliverable — use kapruka_list_delivery_cities), location_type (house/apartment/office/other, default house), date (YYYY-MM-DD, today-or-future Asia/Colombo), optional instructions
- sender (Sender): name + anonymous flag
- gift_message (Optional[str]): Up to 300 chars
- currency (str): LKR (default), USD, GBP, AUD, CAD, EUR
- response_format (str): 'markdown' (default) or 'json'
Returns:
str: Order confirmation with checkout URL.
JSON schema:
{
"checkout_url": str, # Open in browser to pay (no login required)
"order_ref": str, # e.g. "ORD-20260520-7823"
"summary": {
"items_total": number,
"delivery_fee": number,
"addons_total": number,
"grand_total": number, # items_total + delivery_fee + addons_total
"currency": str
},
"expires_at": str # ISO 8601 — link stops working after this
}
Error: "Error (<code>): <message>" on failure. Common codes:
empty_cart, missing_field, past_delivery_date, product_not_found,
product_out_of_stock, city_not_deliverable, date_not_deliverable.