Get your API key

Lesson 3 of 5

Orders and Checkout

Your server creates the order from its own price list, saves it, and the browser opens Razorpay Checkout. One Prompt Card builds it.

9 min Log in to open
One step at a time, like flipping pages.

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

  1. 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
    id 17 Your own id
    name, email, phone Asha Patil Who registered
    ticket_id photo-walk-dec Which ticket
    amount_paise 49900 Copied from the price list, never from the browser
    razorpay_order_id order_... Links your row to Razorpay's order
    razorpay_payment_id empty until paid Filled in after verification
    status created → paid / failed / refunded Only your server changes it
    created_at, paid_at timestamps 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.

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:

  1. Create the order on the server
  2. Open Checkout in the browser
  3. Build it with one Prompt Card
  4. Test it like a customer, then like a cheater
  5. Recap