Zenso Docs
Quickstart
Create a checkout session from your server and redirect your customer to Zenso.
1. Set environment variables
.env
bash
ZENSO_API_BASE=https://api.zenso.lk
ZENSO_SECRET_KEY=sk_test_...Keep secret keys on your server only. Your browser should receive only the checkout_url returned by your backend.
2. Create a checkout session
curl
bash
curl -X POST "$ZENSO_API_BASE/api/v1/checkout/sessions/" \
-H "Authorization: Bearer $ZENSO_SECRET_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_123" \
-d '{
"amount": 3000,
"currency": "LKR",
"description": "Invoice 1001",
"success_url": "https://example.com/success",
"cancel_url": "https://example.com/cancel",
"metadata": {
"order_id": "order_123"
}
}'Response
json
{
"id": "cs_...",
"object": "checkout_session",
"status": "open",
"payment_status": "unpaid",
"checkout_url": "https://pay.zenso.lk/cs/cs_..."
}3. Redirect and fulfill
- Redirect the customer to checkout_url.
- Use success_url and cancel_url to continue the customer experience after checkout.
- Use signed webhooks to fulfill orders on your server.