What Is a Payment Gateway?

A payment gateway is the service that lets a website or app accept payments: the checkout screen where you pick card, UPI, net banking or a wallet. Razorpay, Cashfree, PayU and Stripe are examples. The shop connects to one gateway, and the gateway connects to all the payment systems behind it.

How an Online Payment Works, Step by Step

Checkout pageon the shop’s sitePayment gatewayRazorpay, Cashfree…Card network / UPIroutes itYour bankapprovesShop’s serverships the order1. pay ₹999 by card or UPI2. payment request3. routed to your bankchecks and approves4. approved5. approved6. Payment successful7. webhook: payment captured
The gateway collects the payment, routes it, and tells the shop’s server the result separately, through a webhook.
  1. You choose a payment method on the checkout page and confirm.
  2. The gateway sends the request on: to the card network for a card, or to NPCI for UPI.
  3. Your bank checks and approves, with an OTP for cards or your UPI PIN.
  4. The answer comes back to the gateway, which shows you Payment successful.
  5. Separately, the gateway tells the shop’s server through a webhook: an automatic message saying the payment is captured. That is the moment the shop confirms your order.

Each route is explained step by step in How Credit Card Payments Work and How UPI Works.

Payment Gateway vs Payment Aggregator

  • A gateway is the technology: the checkout, the connections and the routing.
  • A payment aggregator also handles the money: it collects payments for many shops and pays each one out. In India, payment aggregators need an authorisation from the RBI, and most well-known gateways are both.

When Does the Shop Get the Money?

Not instantly. The aggregator collects the day’s payments, deducts its fee, and pays the shop on a fixed schedule, typically the next working day or so. Refunds go the opposite way: the gateway asks the network to return the money to your card or account.

Money Debited but Order Not Placed?

This happens when the payment went through but the confirmation didn’t reach the shop’s system in time, for example because the webhook was delayed. Most of the time the order is confirmed a few minutes later, or the money is refunded automatically. Keep the payment reference from your bank SMS, and contact the shop if it isn’t resolved.

For Engineers: The Webhook Problem

Webhooks can arrive late, twice, or out of order, so a shop’s server must treat every one carefully: check its signature, record each payment ID once (idempotency), and never ship an order twice because a webhook was retried. When a webhook never arrives, ask the gateway for the payment status instead of guessing, and reconcile the gateway’s settlement report against your orders every day.

This article explains how the systems work. It is not financial advice, and limits and rules change: check the current ones with RBI, NPCI or your bank.