Skip to main content
AG·SORA
Technology

Payment Gateway Integration for Websites and Apps: A Guide for Business Owners

Published 12 min readWritten by agsora.tech
AG·SORA / BLOGAG·SORATechnologyPayment Gateway Integrationfor Websites and Apps: AGuide for Business Ownersagsora.tech
In this article

Once a business decides to sell through a website or app, the next question is almost always the same: how will customers pay? In a physical shop the answer is simple, there is a cashier and money changes hands. Online, money moves through several parties at once: the customer, a bank or e-wallet, a payment service provider, and finally your business account. The bridge that connects all of them is called a payment gateway.

Setting up a payment gateway looks like a purely technical job at first glance, but the decision touches many parts of the business. The payment methods on offer affect how many customers complete their orders. The transaction status flow determines whether your stock and orders stay accurate. How funds are paid out affects cash flow. And how security is handled determines how much risk you carry if something goes wrong.

This article is written for business owners and decision makers, not programmers. We cover what a payment gateway actually does, how to choose a suitable one, which payment methods to consider, how a transaction flows behind the scenes, and the things that often get missed such as reconciliation, refunds, and testing. We do not quote specific rates or fees because they differ between providers and change over time; always compare the latest terms from the providers you are considering.

Summary

  • A payment gateway connects your store to banks, e-wallets, and card networks so payments can be received and recorded automatically
  • Choose a provider based on the payment methods your customers use, clarity of fees, payout speed, and the quality of documentation and support
  • Do not rely only on the "success" page in the browser; use server to server notifications to confirm the real payment status
  • Prepare reconciliation, refund handling, and testing in a sandbox before opening real payments
  • Let a trusted provider handle card data; do not store it on your own server

What a payment gateway actually does

A payment gateway is a service that receives payment requests from your website or app, forwards them to the right party such as a bank, e-wallet, or card network, and returns the result. You do not need to build direct relationships with dozens of banks and e-wallets one by one; the gateway provider already offers those connections through a single door.

In practice, a gateway does several jobs at once. It displays or provides a payment interface, verifies the transaction with the bank or e-wallet, records the payment status, and notifies your system when a payment succeeds, fails, or expires. Some providers also handle disbursement of funds to your business account and provide transaction reports.

It is important to understand that a gateway is different from your business bank account. A gateway is an intermediary. Funds paid by customers are usually held first by the provider, then paid out to your account according to that provider's schedule and terms. That schedule affects cash flow, so check it carefully before choosing.

Hands holding a stack of banknotes
Behind the pay button is a long chain that makes sure the customer's money is recorded correctly and reaches the business account.

Payment methods to consider

Not all customers pay the same way. Offering methods familiar to your customers often matters more to transaction success than the design of the button. Here are some groups of methods commonly offered by gateways in Indonesia.

  • Bank transfer or virtual account: the customer gets a unique number to transfer to, and the system matches the payment automatically
  • E-wallets: payment through a wallet app the customer already has
  • QRIS: a single code readable by many payment apps, practical for payments on screen or in person
  • Debit and credit cards: familiar to some customers, with an extra verification layer from the bank
  • Retail outlets or cash payment: useful for customers not yet comfortable paying digitally
  • Instalments or buy now pay later: can help with high value purchases, with their own terms and fees

Rather than switching on every method at once, start with the ones your customers use most. Ask customers directly, or look at the methods they use on other channels. Too many options can confuse, while too few makes some customers give up. You can add methods as data accumulates.

Fees can differ by method

Each payment method usually has its own fee structure, for example a fixed fee per transaction or a percentage of the transaction value. Calculate the effect on your margin for each method, especially if product margins are thin. Some businesses decide to absorb the fees, others raise prices slightly, and some give customers a choice. Whatever you decide, make it transparent so there are no surprises at the end.

How to choose a payment gateway provider

Choosing a provider should be done with a list of criteria, not just from advertising or a friend's recommendation. The following criteria help make a fair comparison.

  1. 01Method fit: does the provider support the methods your customers use
  2. 02Fee clarity: are all fees clearly stated, including registration, per transaction, refund, and payout fees
  3. 03Payout schedule: how long until funds reach your account and whether there is a minimum threshold
  4. 04Documentation and developer tools: are the integration guides clear, is a sandbox available, and are there libraries for the technology you use
  5. 05Reliability and support: what is the service uptime record and how quickly does the support team respond
  6. 06Supporting features: payment links, recurring billing, a reporting dashboard, and integration with the store platform you use
  7. 07Document requirements: which legal documents are required for a business account and how long verification takes

If you use a ready made store platform, first check which providers already have an official integration with it. A ready integration is usually faster and cheaper than building from scratch. If you are building a custom app or website, the quality of documentation and the sandbox becomes a much more important consideration because the development team will depend on them.

The business account verification process

Almost all providers require verification before an account can accept real payments. This process usually covers business details, legal documents, and the destination account for payouts. Start early, because verification can take time and is often an unexpected launch blocker. While waiting, the development team can work in the sandbox.

How the payment flow works behind the scenes

Understanding the basic flow helps you ask the right questions of your technical team or vendor. Put simply, one online transaction goes through several stages.

  1. 01The customer completes the cart and chooses a payment method
  2. 02Your system creates an order record with the status awaiting payment, then asks the gateway to create a transaction
  3. 03The gateway returns a payment link, code, or number, and the customer is directed to pay
  4. 04The customer pays through a bank, e-wallet, or card
  5. 05The gateway receives the result and sends a notification to your system
  6. 06Your system verifies that notification, changes the order status to paid, reduces stock, and triggers shipping

Stages five and six are the ones most often designed wrongly. Many beginner implementations rely only on the "payment successful" page the customer sees in the browser. But the customer may close the page before returning to your store, the connection may drop, or the page can be forged. The correct approach is to rely on server to server notifications from the gateway, often called webhooks or callbacks, as the source of truth for payment status.

A laptop showing the home page of an online store platform
Many online store platforms offer ready made gateway integrations, which can cut launch time.

Why server to server notifications matter

This notification is sent directly from the gateway's system to yours, not through the customer's browser, so it is more reliable. Your system needs to verify that the notification really came from the gateway, for example by checking an agreed signature or token, then match the amount and order number. Notifications can also be sent more than once or arrive out of order, so the system must be designed so that processing the same notification repeatedly has no double effect, such as shipping goods twice.

A safe principle

Treat a payment status as valid only after the gateway confirms it through the server to server route, not because the customer claims to have paid or because a certain page opened in their browser.

Understanding transaction statuses

A transaction is not just "successful" or "failed". There are several states in between, and your system needs to be ready for all of them. Common statuses include awaiting payment, successful, failed, expired because the customer did not pay by the deadline, cancelled, and partially or fully refunded.

Each status has consequences for the business. An order awaiting payment usually holds stock temporarily. If the customer does not pay by the deadline, the stock needs to be released so someone else can buy it. A failed order should give the chance to try again without redoing the whole cart. A refunded order needs stock and financial records adjusted.

Set a reasonable payment deadline. Too short pressures customers; too long holds stock for goods that may never be bought. There is no figure that suits everyone; adjust it to the type of goods, stock availability, and your customers' habits.

A payment experience that improves conversion

A correctly installed gateway does not necessarily produce sales if the payment experience is poor. A few small things matter a lot. Show the total cost clearly before the customer pays, including shipping and other fees. Minimise the number of steps and fields. Make sure the payment page is fast and comfortable on phones, because many customers pay from their phones.

The choice between a redirected gateway hosted payment page and a form embedded in your site also deserves thought. A gateway hosted page is easier and safer because sensitive data does not pass through your server, but its appearance is less customisable. An embedded form gives more control over looks but adds security responsibility. For most small and medium businesses, the provider managed option is the safer starting point.

Handling failed payments

Failed payments are normal: insufficient balance, a dropped connection, or bank verification not passing. Distinguish between failures that can be retried and those that cannot, and show helpful messages instead of just "an error occurred". Offer an easy way out, such as trying another method or contacting you, so the customer does not simply leave.

Security: do not store card data yourself

Payment card data is highly sensitive information strictly regulated by industry standards. Storing and processing it yourself requires meeting heavy security requirements. That is why the recommended practice for almost every business is to let the gateway provider handle card data, so it never touches your server.

Beyond card data, there are other security practices to watch. Keep secret keys and API tokens in a safe place, not in publicly visible code or in the app on customers' phones. Separate keys for the sandbox and live environments. Limit who has access to the gateway dashboard, enable two step verification, and review access regularly. Log transactions and important events so any irregularity is easy to investigate.

Personal data protection rules and payment regulations can change. Refer to the latest provisions from the authorities and your service provider, and do not rely on summaries that may be out of date.

Reconciliation: matching money and records

Reconciliation is the process of matching transaction records in your system with the gateway's report and the funds actually received in your account. It is often neglected until a discrepancy appears that is hard to trace. Make it a routine, for example daily or weekly depending on transaction volume.

Things to match include the number of successful transactions, total value, provider fee deductions, refunds, and payouts. Note that funds arriving in your account are usually net of fees and paid out in a batch covering several transactions, so matching them one by one requires a detailed report from the provider.

If transaction volume is already large, consider automating reconciliation. A system connected to gateway data and the finance module can flag discrepancies automatically, so the finance team only handles exceptions instead of matching hundreds of rows by hand. This also helps keep financial reports accurate, in line with the cash flow topics we often discuss on this blog.

Refunds, disputes, and customer service

No business is free of refunds. Design the flow from the start: who has authority to approve, how the refund is made through the gateway, how long it takes for funds to return to the customer, and how stock and financial records are adjusted. Some payment methods have different limits or processing times for refunds, so give customers an honest estimate.

Disputes or claims from cardholders, often called chargebacks, can also occur with card payments. Keep tidy evidence of transactions and delivery, such as invoices, tracking numbers, and communication with the customer, so you can respond easily if a dispute arises. Clear policies on returns and shipping reduce the likelihood of disputes in the first place.

Also set up an easy support path. A customer who has paid but has not received confirmation will panic. An order status page, automatic confirmation emails, and contacts that respond quickly calm customers and reduce the team's workload.

Testing before launch

Almost all providers offer a test environment or sandbox with test data, so you can try the entire flow without real money. Use it thoroughly. Test not only the success scenario but also failed payments, expiry, duplicate notifications, late notifications, refunds, and partial payments.

After passing in the sandbox, run a limited test with small real transactions before opening to all customers. Make sure the whole chain works: the order is recorded, stock decreases, the confirmation email is sent, funds appear in the dashboard, and reports match. Involve people from operations and finance, not just developers, because they are the ones who will use the results every day.

Hands typing on a laptop keyboard
Careful testing of every payment scenario is cheaper than fixing problems after real customers are affected.

Common mistakes

Several mistakes appear again and again in payment integration projects. Relying on the browser's "success" page as proof of payment is the most common. Storing secret keys where the public can see them is the most dangerous. Not handling duplicate notifications often causes double orders or shipments. Not preparing a refund flow leaves the team confused when the first request arrives. Skipping reconciliation lets small discrepancies pile up into big problems. And launching without testing failure scenarios turns customers into unwitting testers.

Almost all of these mistakes can be prevented with enough planning and serious testing. If you work with a vendor or development team, ask specifically how they handle each point above. A clear, detailed answer is a good sign, while a vague answer deserves caution.

Practical steps to get started

  1. 01List the payment methods your customers use, then compare two or three providers against the criteria above
  2. 02Start the business account verification process early because it can take time
  3. 03Design the order status flow from awaiting payment to completion, including expiry and refunds
  4. 04Make sure the integration uses server to server notifications and verifies their authenticity
  5. 05Test every scenario in the sandbox, then run a limited test with small transactions
  6. 06Schedule routine reconciliation and decide who is responsible

Conclusion

A payment gateway is one of the most important components of an online business, because it is where customer interest turns into money. A well designed integration makes payment feel smooth for customers, keeps order statuses accurate, and keeps finances orderly. A sloppy integration produces orders with the wrong status, funds discrepancies that are hard to trace, and customers who lose trust.

The good news is that you do not have to master every technical detail. Simply understand the principles, ask the right questions, and make sure your team or vendor answers them clearly. Start from the methods customers use most, build a reliable flow, and expand as your business grows.

Need a website or app with reliable online payments?

AG·SORA designs and builds secure payment integrations connected to your stock, orders, and financial reports. The first consultation is free and with no obligation.

Free consultation

Free checklist: choosing a software house

24 points to evaluate a vendor before you sign. Can be saved as a PDF.

Get the checklist

Ready to build a system that grows with your business?

Discuss your needs with the AG·SORA team, no cost, no commitment.