A payment gateway integration connects your website or app to a provider that accepts card and wallet payments and sends the money to your bank. The work has six parts: choosing the gateway, picking how it plugs into your product, handling everything that can go wrong, reconciliation, testing, and going live with monitoring. The "pay now" button is the easy part. This guide walks through each step, with the specifics for Sri Lanka and the GCC.
What the work actually covers
At a minimum, your system creates an order, sends the customer to pay, receives the result from the gateway and updates the order. A complete integration also handles refunds, failed and duplicate payments, webhooks that arrive late, and the settlement report that tells you what actually reached your bank. Most payment problems live in that second list.
Step 1: choose the right gateway
Fees matter, but they're rarely the deciding factor. Compare these as well:
- Payment methods: which cards, wallets and local schemes it supports.
- Customer trust: a name your customers recognise gets more completed payments.
- Payouts: how fast money reaches your bank, and in which currency.
- Onboarding: the documents needed and how long approval takes.
- Developer tools: clear API docs, a sandbox, webhooks and plugins for your platform.
- Support: who you can reach when payments fail on a Friday night.
Sri Lanka
Most online businesses choose between a payment aggregator such as PayHere and a bank's own internet payment gateway (IPG). Aggregators are usually quicker to sign up with, offer plugins for common platforms and cover several cards and wallets through one integration. Bank IPGs need a merchant account with that bank and more paperwork, and rates are agreed with the bank. Genie is another common option, and LankaQR matters if you also sell in person. Many stores still offer cash on delivery next to card payments, so your order system has to handle both cleanly. If you charge in foreign currencies, check how and in which currency the gateway settles.
UAE
Network International (N-Genius), Telr, Checkout.com and Stripe are all common. Apple Pay is expected at checkout, and Tabby and Tamara are popular for instalments. Remember that prices and receipts need to show 5% VAT. More on the local picture on our UAE page.
Saudi Arabia
mada, the national debit network, is essential. Most shoppers expect to pay with a mada card, often through Apple Pay. Local gateways such as Moyasar, HyperPay and PayTabs support mada alongside Visa and Mastercard, and STC Pay is a widely used wallet. If you issue invoices, plan ZATCA's FATOORA e-invoicing at the same time as payments, since both touch the same orders. See our Saudi Arabia page for more.
Qatar and the wider GCC
In Qatar, local debit cards run on the NAPS network and are paid online through QPay, with gateways such as Sadad covering cards more broadly. Kuwait has KNET and Bahrain has BENEFIT. If you sell across the GCC, a regional gateway that supports each country's local scheme saves you from running several separate integrations.
Step 2: pick an integration method
| Method | How it works | Effort | PCI DSS scope | Best for |
|---|---|---|---|---|
| Hosted payment page | The customer goes to the gateway's page to pay, then returns to your site. | Lowest | Smallest | Most small and medium stores |
| Embedded fields | The gateway's secure card fields sit inside your own checkout. | Medium | Small | Brands that want a fully on-brand checkout |
| Platform plugin | A ready-made module for WooCommerce, Shopify or similar. | Low | Depends on the plugin | Standard stores on a supported platform |
| Direct API | Your servers handle card data and call the gateway's API. | Highest | Largest | Larger businesses with PCI DSS compliance in place |
For most businesses, a hosted page or embedded fields is the right choice. Card details never touch your servers, which keeps your PCI DSS obligations light. In mobile apps, use the gateway's native SDK where one exists, and add Apple Pay and Google Pay for faster checkout.
Step 3: design the unhappy paths first
Declined cards, 3-D Secure challenges, timeouts, customers who close the tab halfway, double clicks, partial refunds and chargebacks. Each needs a clear message for the customer and a clear record for your team. A few rules we follow:
- Never trust the browser redirect alone. Confirm every payment with a webhook or a server-side status check.
- Make webhook handling idempotent, so a webhook received twice doesn't ship an order twice.
- Give every order a unique reference and send it to the gateway, so records can be matched later.
- Write plain error messages. "Your bank declined this payment. Please try another card." beats an error code.
- Keep abandoned payments as pending, and expire them after a set time.
Step 4: reconciliation
Every payment, refund, fee and settlement should match between your system, the gateway and your bank statement. Gateways provide settlement reports or APIs for this. If your finance team is matching payments by hand in a spreadsheet each week, the integration isn't finished. Automate the matching using the order reference, and flag anything that doesn't line up.
Step 5: test properly
Use the gateway's sandbox and test cards to run every scenario: success, decline, insufficient funds, 3-D Secure pass and fail, full and partial refunds, and webhooks that arrive late or twice. Test on real phones, not only a desktop browser. Gateways usually review your site before approving live payments, looking at things like your refund policy, terms, contact details and how prices are shown, so have those pages ready early.
Step 6: go live and monitor
Switch to live keys, run a few small real transactions and refund them. Then watch payment success rates, failed payments and webhook errors closely for the first few weeks. Set up alerts so a broken integration is noticed in minutes, not when customers start complaining.
Integration checklist
- Gateway chosen and merchant account approved
- Integration method agreed: hosted page, embedded fields, plugin or API
- A unique order reference sent with every payment
- Server-side confirmation and idempotent webhooks
- Clear messages for declines, timeouts and cancellations
- Full and partial refunds tested
- Reconciliation checked against a real settlement report
- Refund policy, terms and contact pages published
- Live test transactions completed and refunded
- Monitoring and alerts switched on
How long does it take?
A standard integration on a supported platform often takes one to three weeks of build and testing. A custom integration with several payment methods, subscriptions or marketplace payouts takes longer. The gateway's approval process can add time on top, so start the merchant application early, ideally while design is still under way.
Our founder previously led technology at a Sri Lankan payment gateway, so payments get the care they need here. See our work on apps and platforms, including payments. If your checkout is already live and something feels off, our free website health check is a quick place to start.
Questions people ask
What is the difference between a payment gateway and a payment processor?
The gateway is the service your website or app talks to. It collects payment details securely and passes them on. The processor moves the transaction between the card networks and the banks. Many providers now offer both as one service.
Which payment gateway is best in Sri Lanka?
There's no single best. PayHere is quick to set up and covers several payment methods through one integration. A bank IPG can suit higher volumes where rates are agreed with the bank. Compare payment methods, payout times and onboarding for your own business.
Do I need mada for a Saudi online store?
In practice, yes. mada is the national debit network and many Saudi shoppers pay with it, often through Apple Pay. Choose a gateway that supports it from the start.
Do I need to be PCI DSS compliant?
Every business that takes card payments has some PCI DSS responsibility. With a hosted payment page or embedded fields, card data never touches your servers, so your obligations are much lighter, usually a short self-assessment questionnaire.