Guide · v0
Sell event tickets from a v0 app
Last updated
To sell tickets from a v0 app, use the Vihaya Events API as the backend. v0 builds Next.js, so the booking call runs in a route handler with your key kept on the server. Vihaya handles payment, the QR ticket, the ticket email and the payout.
Key facts
- v0 generates Next.js, which fits the Vihaya Events API well.
- The API key lives in an environment variable, never in the browser.
- Buyers pay through Razorpay Checkout opened with an order Vihaya creates.
- Every confirmed booking gets a QR ticket by email.
- Deploys to Vercel like any other v0 project.
Step by step
- 1
Create an API key and store it as a secret
Sign up at Vihaya Events, open Developer → API keys and create a test key. Add it to the v0 project as the environment variable VIHAYA_API_KEY, and to the Vercel project when you deploy. Never put a full key in browser code.
- 2
Create your event
Create the event in the Vihaya dashboard, or through the API. Set the price, ticket tiers and seats there. Your site only displays it and takes bookings.
- 3
Paste this prompt into v0
v0 writes the event pages, the /api/book route and the Razorpay Checkout code.
v0-prompt.txtAdd real event ticket sales to this project using the Vihaya Events API. Do not add Stripe, Razorpay keys, a tickets database table, or buyer accounts. API docs: https://events.vihaya.app/docs OpenAPI: https://events.vihaya.app/api/v1/openapi.json Key: read VIHAYA_API_KEY from the environment. Never send it to the browser. Make the API calls from a server route (for example /api/book) that forwards to Vihaya with the key attached. 1. Events page: GET https://events.vihaya.app/api/v1/events with header x-api-key. Show each item in data[] as a card: title, date, venue, price. 2. Event page: GET https://events.vihaya.app/api/v1/events/{id} plus a form for name, email, phone. 3. Booking: POST https://events.vihaya.app/api/v1/events/{id}/register with { name, email, phone }. - No orderId in the response means it is confirmed (free event). - Otherwise load https://checkout.razorpay.com/v1/checkout.js and open Razorpay Checkout with key = response.key, order_id = response.orderId. 4. In the Razorpay handler, POST register again with { registrationId, orderId, paymentId, signature } taken from the Razorpay response. 5. On success show "You're booked. Your ticket is in your email." - 4
Test, then switch to a live key
With a test key nothing is charged and no email is sent. When the flow works, swap in a live key and publish the event.
Questions
Will it work when I deploy the v0 app to Vercel?
Yes. The Vihaya Events API is plain HTTPS, so it works from Vercel serverless and edge functions. Add VIHAYA_API_KEY to the Vercel project’s environment variables before deploying, then redeploy so the new value is picked up.
Do I need Stripe or Razorpay keys in v0?
No. Vihaya Events creates the Razorpay order and verifies the payment. The v0 app only opens Razorpay Checkout with the public key and order id Vihaya returns. You never store gateway secrets.
Do I need a database for tickets?
No. Vihaya Events stores every registration, payment and ticket. A v0 app selling tickets through Vihaya needs no database of its own, and you can read attendees back through the API.
Can I try it without taking real money?
Yes. Create a Vihaya test key. Test keys only work on test events: no payment gateway is called, no email is sent, no fee is charged and nothing is public. Swap in a live key when you launch.
What does it cost?
Free events cost nothing. Paid tickets carry a 1.75–4.5% Vihaya platform fee plus Razorpay's 3% gateway charge. The rate is fixed when the event is created and larger events get a lower rate. There is no monthly fee and API access is free.
Build the site. Skip the plumbing.
Start with a free test key. Switch to a live key when you are ready to sell.