Quickstart
Create a finalized order, read the hosted invoice URL from the response, and send your customer into the Commerce checkout flow. This guide uses language-native HTTPS so every example calls the published API route directly.
Prerequisites
- A Commerce application
- An opaque API key from the dashboard
- A server-side environment where the key is never exposed to browsers or mobile clients
Check your runtime
The examples below use the HTTP and JSON support included with each runtime:
Runtime availability
curl --version
Configure your API key
Store the opaque token in your deployment's secret manager and expose it to server-side code as COMMERCE_API_KEY:
export COMMERCE_API_KEY=<SECRET_KEY_TOKEN>
Do not infer an environment or permissions from the token's characters. Keep .env files out of source control and rotate a key if it may have been exposed.
Create a finalized order
Send finalize: true to create and seal the order in one request. A finalized order includes an invoice object whose web URL opens the hosted checkout. The response envelope is { "order": { ... } }, so unwrap order before reading invoice.format.web.url.
Create an order
response=$(curl https://api.zebo.dev/orders/new \
-H "Authorization: Bearer $COMMERCE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: checkout-order-123" \
-d '{
"customer_data": {
"name": "Akua Mensah",
"phone_number": "+233544998605"
},
"finalize": true,
"line_items": [{
"product": {
"name": "Monthly Subscription",
"price": { "currency": "ghs", "value": 5000 },
"quantity": 1
},
"type": "product"
}]
}')
invoice_url=$(jq -er '.order.invoice.format.web.url' <<< "$response")
printf '%s\n' "$invoice_url"
Open the invoice URL in the customer's browser. Treat a missing invoice as an incomplete finalization rather than guessing a checkout URL.
Related resources
- Create an order - Complete request and response contract
- Finalize an order - Seal a draft order later
- Authentication - Bearer authentication and key safety
- Accept payment with Zebo Checkout - Complete hosted checkout workflow