Guide · Lovable
Sell event tickets from a Lovable app
Last updated
To sell tickets from a Lovable app, use the Vihaya Events API as the backend. Your Lovable site shows events and a booking form, and Vihaya handles payment, the ticket, the QR code and the payout. You do not need your own Razorpay account. A paste-ready prompt is below.
Key facts
- Vihaya Events works as the ticketing backend for any Lovable app.
- Buyers pay through Razorpay Checkout, opened with an order Vihaya creates.
- Every confirmed booking gets a QR ticket by email automatically.
- A Vihaya checkout key is safe in the browser and can be locked to your domain.
- Test keys let you build without real money.
Step by step
- 1
Create a checkout key
Sign up at Vihaya Events, open Developer → API keys, and create a key with the checkout scope. Add your Lovable domain under allowed origins. A checkout key can list your events and book tickets, but it can never read your attendee list. Start with a test key while you build.
- 2
Create your event
Create the event in the Vihaya dashboard, or with POST /api/v1/events. Set the price, ticket tiers and seats there. Your Lovable site only displays it.
- 3
Paste this prompt into Lovable
Lovable writes the pages and the checkout for you. Save the key as VITE_VIHAYA_CHECKOUT_KEY in the project first.
lovable-prompt.txtAdd real ticket sales to this site using the Vihaya Events API. Do not add Stripe, Razorpay keys, a database table for tickets, or auth for buyers. API docs: https://events.vihaya.app/docs OpenAPI: https://events.vihaya.app/api/v1/openapi.json Key: read it from VITE_VIHAYA_CHECKOUT_KEY (a Vihaya "checkout" key). 1. Events page: GET https://events.vihaya.app/api/v1/events with header x-api-key. Show each event in data[] as a card with title, date, venue and price. 2. Event page: GET https://events.vihaya.app/api/v1/events/{id} and a form for name, email, phone. 3. On submit: POST https://events.vihaya.app/api/v1/events/{id}/register with { name, email, phone }. - If the response has no orderId, the booking is confirmed (free event). - Otherwise load https://checkout.razorpay.com/v1/checkout.js and open Razorpay Checkout with key = response.key and order_id = response.orderId. 4. In the Razorpay handler, POST register again with { registrationId, orderId, paymentId, signature } from the Razorpay response. 5. Show "You're booked, your ticket is in your email" on success. - 4
Test it, then switch to a live key
With a test key nothing is charged and no email is sent. When the flow works, replace it with a live checkout key and publish the event.
Questions
Do I need Stripe or Razorpay in my Lovable app?
No. Vihaya Events creates the payment order and verifies the payment. Your Lovable app only opens Razorpay Checkout with the key and order id Vihaya returns. You never create a payment gateway account of your own.
Do I need a Supabase table for tickets?
No. Vihaya Events stores every registration, ticket and payment. You can pull the attendee list later through the API with a full key. A Lovable app selling tickets through Vihaya needs no ticket table of its own.
Is it safe to put the API key in a Lovable app?
Only a checkout key. A Vihaya checkout key can list events, book and show seat counts, and nothing else. It cannot read attendee data. Lock it to your Lovable domain under allowed origins when you create it.
How do buyers get their ticket?
Vihaya Events emails a ticket with a QR code as soon as the booking is confirmed. Organisers scan it at the gate from a phone in the Vihaya dashboard. Your Lovable app does not generate tickets.
What does it cost to sell tickets this way?
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.