How to integrate online payments into an app or website
Integrating online payments means connecting an app or website to a payment provider that accepts money from cards and other methods and transfers it to the business. This is usually done through a bank's internet acquiring or a payment aggregator, and the buyer enters card details on the provider's secure form rather than in your app. The order total is calculated on the server, the payment status is confirmed by a notification from the provider, and a history is kept for every payment. Refunds, subscriptions and connection failures are planned separately.
Open the software development page
How online payment acceptance works
Several parties take part in every payment: the buyer, your app and its server, the payment provider, the bank that accepts payments for the business, and the buyer's bank. For the user it is a single Pay button, but inside a chain of steps takes place:
- the server creates the order and calculates the amount due;
- the server registers the payment with the provider and receives a link or data for the payment form;
- the buyer enters card details or chooses another method on the provider's side;
- the buyer's bank may ask to confirm the payment, for example with a code;
- the provider reports the result to your server, and the order changes status;
- the money reaches the business account under the terms of the provider agreement.
The key principle of this scheme: your app neither stores nor processes card data, and the decision that an order is paid is made by the server based on the provider's confirmation.
Acquiring, aggregator or gateway: which to choose
These terms are often confused, although they describe different roles:
- Internet acquiring is a bank service that accepts card payments on a website or in an app and credits the money to your business account. The contract is signed directly with the bank.
- A payment aggregator is an intermediary that connects many payment methods at once: cards, wallets, instant payments. Setup is usually simpler, but terms and fees depend on the provider.
- A payment gateway is the technical link that passes payment data between your server, the provider and the banks. It is often part of acquiring or an aggregator.
- Built-in app store payments: for digital goods and subscriptions inside mobile apps, the App Store and Google Play usually require their own billing systems. Their rules differ and change, so they are checked for each specific product.
When choosing a provider, look at your buyers' countries and currencies, the payment methods you need, settlement terms, support for refunds and subscriptions through the API, and the quality of the documentation. Messenger payments have their own rules — see the guide to Telegram Mini Apps.
The payment form and card data
It is safest when card details are entered on the provider's form: on its page, in an embedded widget or in the app's payment sheet. Then the card number never passes through your server, and your product faces much lighter security requirements. Card data processing is governed by industry requirements (the PCI DSS standard), and meeting them fully in-house makes sense only for large players.
The buyer's bank may request payment confirmation — a code from an SMS or approval in the banking app. This is a normal part of the flow, so the interface must correctly bring the user back after such a check and clearly show how the payment ended.
Why the total is calculated on the server
Price, discount, delivery, taxes and currency are always calculated on the server. If the calculation is left to the browser or the app, the request can be tampered with and the order paid for a lower amount. The customer is shown the result, but only what the server calculated is sent for payment.
The order is created before payment and gets its own number, and every payment attempt has a unique key. This protects against double charges if the buyer pressed the button twice or the connection dropped midway.
Webhooks: how to know a payment went through
Returning the buyer to a Thank you page does not yet mean the money has arrived: the person may have closed the tab, and the link can be opened manually. The reliable source is a notification from the provider to your server, called a webhook. Notification handling follows a few rules:
- the notification signature is verified so it cannot be forged;
- the payment status is re-checked with the provider when needed;
- a repeated notification about the same payment does not create a second order or credit money twice;
- if the server was unavailable, the provider resends the notification and the system catches up;
- a regular reconciliation compares payments at the provider with orders in your system.
Refunds, cancellations and disputed payments
Refunds are as much a part of the payment flow as the payment itself. They are made through the provider's API, in full or in part, and the payment gets a clear history in the system: created, paid, cancelled, refunded. Staff should not have to process a refund manually across several dashboards.
Unpleasant cases are planned separately: the payment went through but the item is out of stock; the service cannot be provided; the buyer disputed the payment through their bank. Such scenarios should be handled automatically and consistently, not worked out from scratch each time. If the product has several sellers, payouts and money distribution are added on top — see the guide to marketplace development.
Subscriptions and recurring payments
For subscriptions, the provider stores a secure card token, and your server initiates charges on schedule. It is important to decide in advance what happens when a charge fails: how many retries, when to suspend access and how to warn the customer. Cancelling a subscription should be as clear as signing up, and the customer should see the next charge date and payment history in their customer portal.
Receipts, documents and pre-launch testing
In a number of countries online payments come with receipt and reporting requirements. In Russia, for example, the buyer as a rule must receive a fiscal receipt issued through an online cash register, and many providers offer this as part of the setup. It is best to confirm a specific country's requirements with the provider and an accountant before launch.
Before launch, payments are tested in the provider's test mode: a successful payment, a bank decline, confirmation by code, a double click, payment after the order has expired, full and partial refunds, a lost notification. More about payments in online shops — in the guide to online store development.
Common mistakes when integrating payments
Most payment problems repeat from project to project. They are easier to anticipate than to sort out customer complaints after launch:
- the amount comes from the browser, and the server accepts it without recalculation;
- an order is considered paid when the buyer reaches the Thank you page rather than on the provider's confirmation;
- the signature of the provider's notification is not verified, so it can be forged;
- a repeated notification creates a second order or credits money twice;
- there is no handling for the case where money was charged but the connection to your server dropped;
- the payment provider's keys sit in the code or the repository;
- test and live modes are mixed up, and after launch payments go to the test environment or vice versa;
- refunds are made manually in the provider's dashboard, and the system does not know about them;
- there is no regular reconciliation, so discrepancies between the provider and the accounts are noticed weeks later;
- the buyer does not see a clear status and writes to support to find out whether the payment went through.
Each of these mistakes is closed by a rule, not by manual control: calculation on the server, signature verification, a unique payment key, a processing queue with retries, scheduled reconciliation. It is worth capturing these rules in tests so that later changes do not break them. Payment flows should also be run regularly after launch: providers change their APIs and requirements, and banks change the ways payments are confirmed.
Another common mistake is connecting payments at the last moment before launch. The provider agreement, company verification, setting up payment methods and test mode take time that does not depend on the developers. So choosing a provider and submitting documents is better started in parallel with design rather than after the rest of the product is built.
How JEEKSSHIRE 24 integrates payments
In our projects money is calculated on the server, the customer is shown the result, and the order status changes only after the payment is confirmed. Payment and accounting flows — subscriptions, refunds, reconciliations — are designed together with the rest of the system rather than bolted on at the end. Our own product Wallet works this way: orders are executed through a queue with statuses and automatic refunds, and payment routes are isolated.
We integrate payments into web applications, mobile apps and Telegram bots and Mini Apps. The price depends on the project scope; we do not publish a price list and give an estimate after reviewing the task. All services are on the custom software development page.
Frequently asked questions
How does internet acquiring differ from a payment aggregator?
Acquiring is a bank service with a contract signed directly with the bank. An aggregator is an intermediary that connects many payment methods at once and is usually easier to set up.
Do I need to store card data on my server?
No. It is safer when the card is entered on the provider's form: the number never passes through your server, and the product's security requirements are lower.
How does the server know a payment went through?
From the provider's notification — a webhook. Its signature is verified, and a repeated notification about the same payment does not create a second order.
Can refunds be automated?
Yes, through the provider's API, in full or in part. The system keeps the payment history, including the refund.
Can payments be accepted inside a mobile app?
Yes. For physical goods and services a payment provider is connected, while for digital goods and subscriptions app stores usually require their own built-in billing.