Payment Gateway Integration: What to Settle Before You Write Code

A payment gateway integration is mostly a design decision, not an API call. Here is how to think through security obligations, the real fee stack, failure-path testing and daily reconciliation before you go live.

On this page
  1. Map the payment flow before you evaluate vendors
  2. Security obligations you inherit, not buy
  3. Read the fee stack, not just the headline rate
  4. Test the paths that actually break
  5. Reconciliation is a product feature, not a spreadsheet
  6. A short pre-launch checklist

A payment gateway looks like small plumbing: collect the customer's details, call an API, show a success screen. In practice, the integration decisions ripple through your security posture, your unit economics, your support load and your finance team's daily routine. Wiring up an SDK is usually the shortest part of the project. The longer work is deciding what happens when a payment succeeds on the gateway's side but fails in your own database, or when a customer disputes a charge six weeks after your release notes have moved on.

This is a pre-build checklist for engineering and product teams at Indian businesses preparing a payment gateway integration, covering cards, UPI, net banking and wallets. It does not recommend a specific provider; it focuses on the questions that determine whether the integration holds up after launch.

Map the payment flow before you evaluate vendors

Write down every state a payment can occupy in your system: initiated, authorised, captured, failed, cancelled, partially refunded, fully refunded, settled, disputed and reversed. Then decide which system is the source of truth for each state. Most integration bugs come from ambiguity here rather than from the gateway's API.

Decide early whether you want a hosted checkout page, an embedded iframe, or a fully native experience using the gateway's mobile SDKs. Each choice shifts responsibility. A hosted page reduces your compliance surface but limits control over the user experience and analytics. A native flow gives you more control but puts more of the failure handling, retry logic and UI states in your hands. Also plan your UPI approach: intent-based flows behave differently from collect requests, and the callback path is not always the same as with cards.

Security obligations you inherit, not buy

No gateway can make your application secure on your behalf. What a good integration does is reduce your compliance scope. Use hosted fields, tokenisation or the gateway's vault so that raw card numbers never touch your servers, your logs or your support tooling. In India, card-on-file tokenisation norms mean you should expect to store tokens issued through the ecosystem rather than card credentials, so design your data model around token references from day one.

The basics still matter: serve checkout over TLS, verify webhook signatures rather than trusting the payload, keep API secrets in a secrets manager instead of a repository or a front-end bundle, and restrict who inside your organisation can trigger refunds or modify payment records. Log request identifiers and statuses, never full card data. Treat your admin panel as a privileged surface, because a compromised admin account can do more damage than a compromised checkout page.

Finally, document your authentication story. Card payments typically involve an issuer-driven verification step, and the redirect back to your application is a place where sessions expire and users abandon. Make sure a payment that succeeds after a timeout is still honoured by your system rather than silently dropped.

Read the fee stack, not just the headline rate

Published pricing rarely matches the invoice. Ask for the complete structure: the rate per payment method, platform or convenience fees, per-transaction charges on low-value orders, refund fees, chargeback handling fees, annual or monthly maintenance, setup costs, and whether the payment fee is returned when you refund a customer. Remember that fees attract GST, which affects your effective cost.

Then model your actual method mix. A business with a high share of UPI transactions has a very different blended cost from one dominated by credit cards, and card pricing can vary by network and category. Ask about settlement timing and whether it changes for weekends and holidays, whether a rolling reserve applies, and what the minimum billing commitment looks like during a slow quarter.

Commercial terms deserve the same scrutiny as the API. Negotiate volume thresholds, understand the notice period, and confirm that you can export transaction and customer token data if you switch providers. Portability is cheap to ask for before signing and expensive to obtain afterwards.

Test the paths that actually break

Sandbox testing that only covers the happy path gives false confidence. Build a test plan around the failures your support team will see in month one:

  • Duplicate webhook deliveries and out-of-order events for the same order.
  • Browser closed or network dropped after the customer authorised the payment.
  • Gateway timeout with a subsequent successful capture.
  • Partial refunds, multiple refunds on one payment, and refunds issued days after settlement.
  • Retries and idempotency: the same request sent twice must not create two charges.
  • Amount rounding and currency edge cases, especially where taxes are computed per line item.

Test on real devices and throttled networks, not only on a fast office connection. Issuer verification pages sometimes behave differently from the sandbox simulation, so run a small live pilot with internal users before a full rollout. Load-test your webhook endpoint, because a burst of simultaneous confirmations during a campaign is a realistic scenario. Write a runbook for the on-call engineer that explains how to check a payment's status directly with the gateway when your own records are unclear.

Reconciliation is a product feature, not a spreadsheet

Every day, three sources of truth need to agree: the gateway's settlement report, your order ledger, and the money that actually landed in your bank account. If you cannot match a settlement line to an order in seconds, your finance team will build a manual process that quietly consumes hours each week.

Store the gateway's payment identifier on your order alongside your own order ID, and keep an immutable record of status changes with timestamps. Build an automated daily job that ingests the settlement file and produces an exception queue for mismatches. Expect legitimate timing differences around midnight cut-offs, settlements that lag by a day, refunds that appear in a later cycle, and chargebacks that arrive weeks later with their own fees.

Give support a lookup screen that shows a payment's full lifecycle without exposing sensitive data, and give finance a dashboard that shows settled, pending and disputed amounts. Reconciliation also feeds your accounting entries, so agree early with whoever closes the books on how refunds, fees and GST are recorded.

A short pre-launch checklist

  • Payment states and ownership defined, with idempotency keys in place.
  • No card data stored, logged or displayed outside the gateway's scope.
  • Webhook signature verification and retry handling implemented.
  • Full fee stack modelled against your real method mix, including GST.
  • Failure, duplicate, refund and timeout paths tested in a live pilot.
  • Automated daily reconciliation with an exception queue and an owner.
  • Written escalation path with the provider for stuck settlements and disputes.

None of this is glamorous, and most of it will never appear in a product demo. But payment gateway integration is judged on the days something goes wrong, not the day it shipped. Teams that treat security, fees, testing and reconciliation as design inputs rather than afterthoughts spend far less time firefighting after launch.

StopLord Editor Team

Engineering & Content

Practical guides from the StopLord Technologies team on web development, mobile apps, cloud, security and digital growth.

Keep reading

Let’s talk

Have a project in mind? Let’s build it together.

Tell us what you want to achieve. We will reply with honest advice, a clear scope and the next steps — no obligation.