By the end of this lesson Meera's registration page will create a Razorpay order on your server at the server's own price, open Razorpay Checkout in the browser, and save every registration in your database, all in test mode.
You need: test keys in .env (lesson 2), a web project with a backend (for example Next.js, see Build your first web MVP), your coding agent · Time: 9 minutes
Before any payment code, decide where the truth lives. Two things must exist only on your server:
- The price list. For example
{ "photo-walk-dec": 49900 }: ticket id → price in paise. The browser only ever says which ticket. - The registrations table. One row per attempt, so you always know who tried to pay, who paid and who didn't.
A simple design (how to design tables is in Design your tables):
Column Example Why id17Your own id name,email,phoneAsha PatilWho registered ticket_idphoto-walk-decWhich ticket amount_paise49900Copied from the price list, never from the browser razorpay_order_idorder_...Links your row to Razorpay's order razorpay_payment_idempty until paid Filled in after verification statuscreated→paid/failed/refundedOnly your server changes it created_at,paid_attimestamps For support and reconciliation Why?Every payment bug that loses money starts with the browser deciding something: the price, or "paid". If the price list and the status live only on the server, a user with DevTools can change nothing that matters.
- The price list. For example
Log in free to read the rest of this lesson
Every lesson is free. A free account unlocks all of them and saves your progress.
Still to come in this lesson:
- Create the order on the server
- Open Checkout in the browser
- Build it with one Prompt Card
- Test it like a customer, then like a cheater
- Recap