To add a payment gateway to your website or app, you sign up with an RBI-authorised payment aggregator (or your bank), complete its KYC with a live website or app, and then connect its checkout to your own server. Your server creates an order, the customer pays in the gateway's checkout, your server verifies the payment, and a webhook confirms the final status. You test everything with test keys, then switch to live keys.
This guide walks through each stage with a checklist you can hand to your developer. We use Razorpay's documentation as the worked example because it is public and detailed, but the same pattern applies to most gateways. Always follow your own provider's docs for the exact names and settings.
What a payment gateway does, and who regulates it
A payment gateway is the checkout and technology that lets a customer pay by UPI, card, net banking or wallet. Most businesses get it through a payment aggregator (PA), a company that collects payments on behalf of many merchants and then settles the money to each one.
RBI's Master Direction on Regulation of Payment Aggregators, issued on 15 September 2025, sets the rules. The points that matter for a business owner:
- Authorisation: a non-bank company must be authorised by RBI to operate as a PA. Check that your provider is.
- Merchant checks: the PA must carry out customer due diligence on you under RBI's KYC rules, so expect to submit business documents.
- Escrow: a non-bank PA keeps the money it collects for merchants in a separate escrow account with a scheduled commercial bank in India.
- Settlement: when you receive your money is set by your agreement with the PA, which must state the timelines clearly.
- Refunds: refunds go back to the original payment method unless the customer asks otherwise.
- Card data: customer card credentials must not be stored in any database or server the merchant can access. In practice, let the gateway's checkout collect card details so they never touch your systems.
What to have ready before you apply
Prepare these first:
- KYC documents for your business, as your provider lists them.
- A live website or app. Razorpay says you must give live website or app details during account activation, and without them you cannot get live mode API keys.
- Policy pages. Razorpay asks for links to About us, Contact us, Pricing details, Terms and conditions, Privacy policy and a Refunds policy.
- Clear prices for what you sell, shown on the site.
- A server or back end that can keep a secret key safe. A purely static site cannot verify payments on its own.
How to compare gateways
Ask every provider the same questions and get the answers in writing.
| What to compare | What to ask |
|---|---|
| Payment methods | Which UPI, card, net banking and wallet options are on by default, and which need extra approval? |
| Pricing | What is the fee per method, is GST extra, and are there setup or annual charges? |
| Settlement | How many days after a payment does money reach your bank, and is that in the agreement? |
| Integration | Is there a hosted checkout, an SDK for Android, iOS or Flutter, and a plugin for your platform? |
| Refunds and disputes | Can staff refund from the dashboard or by API, and how are chargebacks handled? |
| Reports | Can you export settlements and match them to your orders easily? |
The integration flow, step by step
This is the server-side flow from Razorpay's Standard Checkout docs. Other gateways follow a similar pattern.
- Generate test API keys in the gateway dashboard. You get a public key ID and a secret. The secret stays on your server only.
- Create an order on your server when the customer clicks Pay. Razorpay's Orders API takes the amount in the smallest currency unit, which for rupees is paise. Save the order ID against your own order.
- Open the checkout in the browser or app, passing your key ID and that order ID.
- Receive the result. After a successful payment, checkout returns a payment ID, an order ID and a signature. Send all three to your server.
- Verify the signature on your server. Razorpay's method is an HMAC SHA256 of your stored order ID and the payment ID, using your key secret, compared with the signature you received. Use the order ID you saved, not the one sent back by the browser. Only fulfil the order if they match.
- Capture the payment. Authorised payments must be captured or they are refunded automatically after a set period, so turn on automatic capture or capture by API. Razorpay also notes that payments made without an order ID cannot be captured and are refunded.
- Listen for webhooks such as
order.paidto confirm the status from the server side, even if the customer closed the browser.
Webhooks: the step most sites skip
A customer's phone can lose signal right after paying. If your site relies only on the browser telling it the payment worked, that order stays unpaid in your system. Webhooks fix this: the gateway calls your server directly when the payment status changes. See how webhooks work.
Razorpay's webhook docs set out the rules to build for:
- Check the signature. Each request carries a hash in the
X-Razorpay-Signatureheader, made with your webhook secret. Reject anything that does not match. - Reply with a 2xx status quickly. Any other response counts as a failed delivery. Razorpay retries with exponential backoff for 24 hours, then disables the webhook if it keeps failing.
- Expect duplicates. The same event can arrive more than once. Store the
x-razorpay-event-idand skip events you have already processed.
Adding payments to a mobile app
Gateways commonly offer SDKs for Android and iOS, and the server flow above stays the same. The bigger question is whether the app stores let you use a gateway at all.
- Google Play: its Payments policy generally requires Google Play's billing system for paid downloads and for in-app digital features, content and subscriptions. It must not be used for physical goods (such as groceries or clothing), physical services (such as transport or cleaning) or credit card and utility bill payments. Those go through your gateway. Google also runs alternative billing programmes in eligible countries, so check what applies to your app.
- Apple App Store: guideline 3.1.1 says unlocking features or content inside the app needs in-app purchase. Guideline 3.1.3(e) says physical goods or services used outside the app must use other methods, such as Apple Pay or card entry.
So a shop, clinic booking or delivery app uses a gateway, while a paid course or premium-feature app needs to check the store rules first. Our mobile app development team checks this when planning the app.
Testing and going live
- Run test payments with the gateway's test cards and test UPI IDs. Razorpay, for example, provides
success@razorpayto simulate a successful UPI payment. - Test the unhappy paths too: a failed payment, a customer who closes the page mid-payment, a double click on Pay, and a full and a partial refund.
- Confirm the webhook marks the order as paid even when the browser step never completes.
- Check that the key secret is stored in server settings, not in your website or app code.
- Work through your provider's go-live checklist, generate live keys and replace the test keys.
- Make one small real payment and refund it before announcing the launch.
Once payments work, you can send payment links and reminders on WhatsApp. Automate AI's guide to WhatsApp payments covers that side.
UC Tech builds checkout flows for online stores and custom websites. If you want help connecting a gateway to your site, app or CRM, talk to us.
Frequently asked questions
Do I need a website to accept online payments?
For a full checkout on your own site, yes. Razorpay requires live website or app details before it issues live API keys. You can still collect payments through dashboard Payment Links and Invoices without one.
Can I save customers' card numbers for faster repeat payments?
No. RBI's Payment Aggregator directions say customer card credentials must not be stored in a database or server the merchant can access. Use your gateway's own saved-card and recurring payment features instead.
How long does it take to receive the money?
Settlement timing is set in your agreement with the payment aggregator, and RBI requires that agreement to state the timelines clearly. Ask for it in writing before you sign.
Should I use a plugin or a custom integration?
If your store runs on WooCommerce or Shopify, start with the gateway's official plugin or app (see our store platform comparison). Custom sites, web apps and mobile apps need the server-side integration described above.
Sources
Want this built for your business?
UC Tech builds software, apps, websites and WhatsApp automation.