Initialize a unified payment checkout session across Stripe, Razorpay, PhonePe, or CCAvenue for one-time, subscription, and digital product charges.
This endpoint creates a unified checkout session. ZezoPay computes discounts, connects to the requested payment processor, creates the underlying gateway order, and returns the public configuration and orderId needed by your frontend to launch the payment modal.
https://payapi.zezo.in/api/v1/payments/checkout| Parameter | Type | Required | Description |
|---|---|---|---|
x-public-key | string | Required | Your Public Key. |
x-secret-key | string | Optional | Your Secret Key (recommended for server-to-server checkouts). |
x-platform | string | Optional | Target platform: `web`, `android`, or `ios`. Default: web |
Content-Type | string | Required | Payload encoding format. Default: application/json |
| Parameter | Type | Required | Description |
|---|---|---|---|
userId | string | Required | Unique identifier of the customer in your application. |
type | string | Optional | Checkout purchase category: `normal`, `subscription`, or `digital-product`. Default: normal |
provider | string | Required | Target gateway: `stripe`, `razorpay`, `phonepe`, `ccavenue`, or `cashfree`. |
price | number | Optional | The transaction amount in major units (e.g. 499 for ₹499 or $4.99). Required for `normal` checkout. |
currency | string | Optional | ISO-4217 3-letter currency code (e.g. `INR`, `USD`, `EUR`). Default: INR |
subscriptionId | string | Optional | The plan ID or subscription plan reference. Required when `type` is `subscription`. |
digitalProductId | string | Optional | The digital product ID to purchase. Required when `type` is `digital-product`. |
coupon_code | string | Optional | Discount coupon code to apply at checkout for instant discount deduction. |
metadata | object | Optional | Custom business metadata, customer details, and feature flags passed through to webhooks. |
metadata.userInfo | object | Required | Customer information object containing `name`, `email`, and optional `phone`. |
curl -X POST "https://payapi.zezo.in/api/v1/payments/checkout" \
-H "x-public-key: zp_pub_xxxxxxxxxxxxxxxxxxxx" \
-H "x-secret-key: zp_sec_xxxxxxxxxxxxxxxxxxxx" \
-H "x-platform: web" \
-H "Content-Type: application/json" \
-d '{
"type": "normal",
"userId": "usr_9912059abc",
"price": 499,
"currency": "INR",
"provider": "razorpay",
"coupon_code": "WELCOME10",
"metadata": {
"isPaymentInitiatedEnabled": true,
"userInfo": {
"name": "Sarah Connor",
"email": "sarah.connor@example.com",
"phone": "+919876543210"
}
}
}'{
"price": 449.10,
"real_price": 499,
"currency": "INR",
"provider": "razorpay",
"orderId": "order_NX8aBz10Q1pLMq",
"publicKey": "rzp_live_xxxxxxxxxxxx",
"status": true
}Returned when required fields (e.g. userId, provider, or userInfo) are missing.
{
"type": "BadRequestError",
"status": 400,
"msg": "Missing required field: metadata.userInfo.email",
"path": "metadata.userInfo.email"
}{
"type": "UnauthorizedError",
"status": 401,
"message": "Authentication Failed"
}