# Sell event tickets from a Bolt.new app

> To sell tickets from a Bolt.new app, use the Vihaya Events API as the backend. Bolt apps usually run React in the browser, so use a Vihaya checkout key locked to your domain. Vihaya handles payment, the QR ticket, the ticket email and the payout.

Last updated: 2026-10-04

## Key facts

- Bolt.new apps can call the Vihaya Events API directly from the browser.
- A Vihaya checkout key is safe in browser code and can be locked to your domain.
- Buyers pay through Razorpay Checkout; no gateway account is needed.
- Every confirmed booking gets a QR ticket by email.
- 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 site’s domain under allowed origins. A checkout key can list your events and book tickets, but can never read your attendee list. Use a test key while you build.

### 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 Bolt

Save the key in the project’s .env file as VITE_VIHAYA_CHECKOUT_KEY first (Vite only exposes variables that start with VITE_).

```text
Add 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: a Vihaya checkout key (safe in the browser, locked to this domain).
The calls can be made directly from the browser; the API allows cross-origin requests.

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

### Is it safe to call the API from a Bolt app’s browser code?

Yes, with a checkout key. A Vihaya checkout key can list events, book tickets and read seat counts, but never the attendee list. Lock it to your deployed domain under allowed origins.

### Does it still work after deploying from Bolt?

Yes. The Vihaya Events API allows cross-origin requests, so the deployed site calls it the same way the preview does. Add the deployed domain to the checkout key’s allowed origins.

### Do I need Supabase for tickets in Bolt?

No. Vihaya Events stores registrations, payments and tickets. A Bolt app selling tickets through Vihaya needs no tickets table, though you can keep Supabase for anything else your app does.

### 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.

## Related

- [Sell event tickets from a Lovable app](https://events.vihaya.app/developers/lovable)
- [Sell event tickets from a v0 app](https://events.vihaya.app/developers/v0)
- [Sell event tickets from a Replit app](https://events.vihaya.app/developers/replit)
- [Vihaya Events for developers](https://events.vihaya.app/developers)


---

Canonical URL: https://events.vihaya.app/developers/bolt
Last updated: 2026-10-04
API reference: https://events.vihaya.app/docs
OpenAPI spec: https://events.vihaya.app/api/v1/openapi.json
Brief AI index: https://events.vihaya.app/llms.txt
Full AI index: https://events.vihaya.app/llms-full.txt
