Preview storefront  ·  Every piece ₹699 · Sizing & checkout are previews — no real payment

Rarefit

Admin · Razorpay

Take money online.

UPI, cards and netbanking via Razorpay popup. Shoppers never type card details into Rarefit.

Checking sign-in…

Sign in

Checking key…

Test checkout →

Step 1 · 5 minutes

Get your Razorpay test keys

  1. Open dashboard.razorpay.com → sign up as a business → stay in Test mode (sidebar toggle).
  2. Go to Settings → API Keys → Generate Key → copy the Key ID (starts with rzp_test_).
  3. Keep the Key Secret private — it goes only in the Cloud Function below, never in the site.

Step 2 · 2 minutes

Paste the Key ID, rebuild

  1. In the project, open .env and set PUBLIC_RAZORPAY_KEY_ID=rzp_test_xxxx.
  2. Run npm run build (or restart npm run dev).
  3. Open checkout → choose Pay online → badge reads Test mode. Done — try a payment below.

Step 3 · test cards (no real money)

Try a test payment

  • Card: 4111 1111 1111 1111, any future expiry, any CVV, any name.
  • UPI: use VPA success@razorpay to simulate success, failure@razorpay to simulate failure.
  • Paid orders land in Orders with status paid + payment id, and in the customer's account.
Step 4 · recommended: order server (Cloud Function)

Without this, the site opens Checkout with the total directly (fine for testing). With it, the amount is locked server-side so it can't be tampered with. Deploy once:

// functions/index.js  (firebase init functions, then: npm i razorpay)
const { onRequest } = require("firebase-functions/v2/https");
const Razorpay = require("razorpay");
const crypto = require("crypto");

const rzp = () => new Razorpay({
  key_id: process.env.RAZORPAY_KEY_ID,
  key_secret: process.env.RAZORPAY_KEY_SECRET,
});

exports.createOrder = onRequest({ cors: true }, async (req, res) => {
  try {
    const amount = Math.round(Number(req.body.amount));
    if (!amount || amount < 100) { res.status(400).json({ error: "Bad amount" }); return; }
    const order = await rzp().orders.create({ amount: amount, currency: "INR" });
    res.json({ id: order.id });
  } catch (e) { res.status(500).json({ error: "Order failed" }); }
});

exports.verifyPayment = onRequest({ cors: true }, async (req, res) => {
  const b = req.body || {};
  const text = b.razorpay_order_id + "|" + b.razorpay_payment_id;
  const expected = crypto.createHmac("sha256", process.env.RAZORPAY_KEY_SECRET)
    .update(text).digest("hex");
  res.json({ ok: expected === b.razorpay_signature });
});
  1. Set secrets: firebase functions:secrets:set RAZORPAY_KEY_ID (and RAZORPAY_KEY_SECRET).
  2. Deploy: firebase deploy --only functions, then set PUBLIC_RAZORPAY_ORDER_URL=https://…cloudfunctions.net/createOrder in .env and rebuild.
Step 5 · go live checklist
  • Complete Razorpay KYC → switch to Live mode → replace the Key ID with rzp_live_… → rebuild. Checkout badge flips to Live.
  • Add a Razorpay webhook (payment.captured) pointing at your function to mark orders paid even if the shopper closes the tab.
  • Refunds happen in Razorpay dashboard → Payments → Refund (do this before touching stock back).
  • Never commit the Key Secret to git — secrets live in Cloud Functions config only.