Adding online payment to a website is one of those jobs that looks small and takes longer than expected. Most of the delay is not the programming. It is choosing a provider, getting an account approved and testing every way a payment can go wrong. This guide covers what to decide before you start.
What a payment gateway does
A payment gateway sits between your website and the customer's way of paying. The customer chooses a method on your checkout, is taken to a secure payment page, pays, and is sent back to your site. The gateway tells your website whether the payment worked. Because the gateway handles the sensitive part, your website does not need to store card numbers or wallet PINs.
Start with how your customers pay
In Bangladesh, customers commonly pay with mobile wallets such as bKash, Nagad and Rocket, with bank cards, and with cash on delivery. Before you pick a provider, find out which of these your own customers actually use. A gateway that supports a method nobody in your market uses adds cost without adding sales.
Direct connection or one provider for many methods
There are two usual ways to connect.
- A direct connection to one method, for example a mobile wallet provider. You deal with that provider alone, and each extra method is another connection
- A payment aggregator such as SSLCommerz or aamarPay, which offers several methods through one integration and one account
An aggregator is often simpler when you want to offer more than one method. A direct connection can make sense when almost all your customers use a single wallet. Either way, ask each provider for its current terms, because they change.
Questions to ask every provider
Ask these in writing and keep the answers. Do not compare providers on one headline rate alone.
- What are the charges for each payment method, and are there setup or monthly fees?
- How long until the money reaches your bank account after a customer pays?
- Which business documents do you need to open a merchant account, and how long does approval usually take?
- Is there a test environment, often called a sandbox, so we can try payments without real money?
- How are refunds and failed payments handled, and can they be done from a dashboard?
- What support do you offer when something goes wrong, and how quickly do you reply?
The account approval step is often slower than the development, so start it early. It is common for a website to be ready while the merchant account is still being reviewed.
Do not trust the customer's browser
This is the most important technical point. When a customer finishes paying, they are sent back to your site. Do not mark the order as paid just because that page loaded. A customer can close the window early, or someone can try to open the success page directly.
Instead, your server should confirm the payment with the gateway, using the gateway's verification method or its server-to-server notification. Only when the gateway confirms the amount and the order should the order be marked as paid and stock reduced.
Plan for the messy cases
Real payments go wrong in small ways, and your website should expect them.
- The customer pays but closes the page before returning to your site
- The same notification arrives twice, so an order must not be counted twice
- The payment fails, and the customer should be able to try again without creating a second order
- The amount paid does not match the order total
- A refund is needed after delivery
Each of these needs a clear state on the order, such as pending, paid, failed or refunded, so your team always knows where an order stands.
Keep the gateway replaceable
Providers change their terms, and you may want to add a second method later. A good build keeps the payment part separate from the rest of the shop, so adding or switching a gateway means changing one part instead of rewriting checkout.
Test before you launch
- Try a successful payment with each method you offer
- Try a cancelled payment and a failed payment
- Try closing the payment page halfway through
- Check that the order list, the stock count and the customer's confirmation all agree
- Do a test on a phone, because most customers will pay on one
Talk to GrapCode
If you are planning an online shop or want to add payment to an existing website, message GrapCode on WhatsApp. Tell us what you sell and how your customers pay today, and we will explain what the integration involves. Pricing is by custom quotation after a short conversation. You can read about our e-commerce development service, or, if you are still deciding whether you need a shop at all, read Facebook page or website for selling online.


