Payment gateway API integration is the step where your website, SaaS platform or booking system starts taking real money. Done well, customers pay with bKash, Nagad or their bank and your system updates the order automatically. Done badly, you get missing orders, double charges and support tickets. This developer-focused checklist walks through payment gateway API integration for Bangladeshi businesses, from sandbox to go-live, using KarentPay as the example.
How a Payment Gateway API Works
Almost every payment gateway API follows the same basic pattern:
- Create a payment – your server sends the amount, order reference and customer details to the gateway using your API credentials.
- Redirect the customer – the gateway returns a secure checkout URL where the customer chooses bKash, Nagad, Rocket, Upay, Cellfin or internet banking.
- Customer pays – the payment is completed on the gateway's secure page.
- Receive the result – the gateway tells your system the outcome, usually through a callback/redirect and a server-side notification.
- Verify and fulfil – your server double-checks the status with the gateway before marking the order as paid.
Understanding this flow makes any integration easier, whether you use PHP, Laravel, Node.js, Python or a no-code platform.
Payment Gateway API Integration Checklist
Before you write code
- Open a merchant account and complete KYC so you can receive credentials.
- Read the API documentation end to end. For KarentPay, it is available at karentpay.com/documentations.
- Map your order states – pending, paid, failed, cancelled – and decide which gateway status maps to which.
- Decide your payment methods – with KarentPay, bKash, Nagad, Rocket, Upay, Cellfin, internet banking and multiple banks are available through one integration, so you do not need a separate API for each wallet.
Security essentials
- Keep API keys on the server only. Never put secret keys in JavaScript, mobile app code or public Git repositories.
- Use HTTPS everywhere. Your callback URLs must be served over SSL.
- Calculate the amount on the server. Never trust a price sent from the browser.
- Verify every payment server-side before releasing goods or services, even if the redirect says "success".
- Log requests and responses (without sensitive data) so you can trace problems later.
Handling callbacks correctly
- Make processing idempotent – if the same notification arrives twice, the order should only be marked paid once.
- Match the order reference and amount against your database before accepting a payment.
- Handle abandoned payments – some customers close the tab; leave those orders pending and expire them after a set time.
- Show a clear result page – tell customers whether their payment succeeded and what happens next.
Choosing Auto vs Manual Transfer
KarentPay supports both automatic and manual transfer flows. Automatic confirmation is ideal for websites and apps where you want orders updated without human checks, such as SaaS subscriptions, digital downloads and online bookings. Manual options can suit businesses that review certain orders before accepting them. Many merchants use automatic confirmation for most orders and keep a manual review step for unusual ones.
Integration Options by Platform
WordPress and WooCommerce
You may not need to touch the API at all. Install the "KarentPay" plugin from WordPress.org, enter your credentials and enable the payment methods you want.
Custom websites (PHP, Laravel, Node.js, Python)
Use the REST API from your backend: create a payment, redirect the customer, then verify the result in your callback handler.
Mobile apps
Let your backend create the payment and return the checkout URL; open it in a secure in-app browser and confirm the result from your server, not from the app alone.
SaaS and booking platforms
Tie each payment to an invoice or booking ID, and unlock the plan or seat only after your server verifies the payment.
Testing Before Go-Live
- Run successful, failed and cancelled payments for every method you enable.
- Send duplicate callbacks to confirm your idempotency logic.
- Try changing the amount in the browser to make sure the server rejects it.
- Check emails, invoices and dashboards update correctly.
- Make a small live payment after switching to production credentials.
Common Integration Mistakes to Avoid
- Marking orders as paid based only on the browser redirect.
- Hard-coding API keys in front-end code.
- Ignoring failed or pending statuses, leaving customers confused.
- Not storing the gateway's transaction reference with the order.
- Skipping tests for each wallet and bank option.
Frequently Asked Questions
What is payment gateway API integration?
It is connecting your website, app or software to a payment gateway through its API so customers can pay online and your system receives and verifies the payment result automatically.
How do I integrate a payment gateway in my website in Bangladesh?
Open a merchant account, get API credentials, follow the gateway's documentation to create payments and handle callbacks, test thoroughly, then go live. WordPress users can use the KarentPay WooCommerce plugin instead.
Can one API accept bKash, Nagad and bank payments?
Yes. With KarentPay, bKash, Nagad, Rocket, Upay, Cellfin, internet banking and multiple banks are available through a single integration.
Where can I find the KarentPay API documentation?
The developer documentation is at karentpay.com/documentations.
Is payment gateway API integration secure?
It is secure when you keep keys on the server, use HTTPS, verify each payment server-side and use a gateway with SSL secure processing.
Build Your Integration with KarentPay
A clean payment gateway API integration means fewer support tickets and happier customers. KarentPay gives Bangladeshi developers one API for bKash, Nagad, Rocket, Upay, Cellfin and internet banking, plus a WooCommerce plugin for WordPress stores. Visit karentpay.com to open your merchant account and start integrating today.

