Payment Gateway Integration: How to Integrate a Payment Gateway in a Website and Mobile App (2026 Guide)


Online sales keep growing. The U.S. Census Bureau estimates retail e-commerce sales at $340.2 billion in Q2 2026, about 17% of all US retail. With that much revenue passing through checkout, a payment integration is no longer a plugin decision.
Three things changed since most integration guides were written. Since March 2025, PCI DSS treats the scripts on your payment page as part of your security scope. Outages at major payment providers have stopped entire purchase flows for merchants with a single gateway. And AI agents have started to complete purchases on behalf of buyers.
In the post below, you will discover how payment gateways work, which integration method fits your business, how to choose a gateway, and how to integrate it into a website and a mobile app — without creating compliance, outage or rework risk.
What is a payment gateway
A payment gateway is a service that bridges the gap between a merchant and customers. End users click the purchase button, share their card or wallet details, and pay for a product or service. For buyers, the process is fast and hassle-free. For the merchant, the gateway is the part of the stack that touches the most sensitive data the business handles.
How does a payment gateway work?

Let’s check how payment gateways work in more detail.
A gateway collects payment information, encrypts it, checks that the payment method is valid, and passes the data to a payment processor. The processor routes the request through the card network to the issuing bank, which approves or declines it. Money is then drafted from the customer’s account and settled to the merchant’s account, minus processing fees.
Most popular gateway providers have built-in payment processors, so one provider can collect payment data and charge customers. Larger merchants often separate the two layers: a gateway or orchestration layer on top, one or several acquirers underneath.
Payment gateway integration methods: redirect, iframe, JavaScript or API

The original split into hosted and non-hosted gateways still holds, but in 2026 it is more useful to look at four integration patterns. Each one decides who renders the payment form, where card data travels and which PCI DSS self-assessment questionnaire (SAQ) usually applies.
| Method | How it works | Checkout control | Typical PCI DSS SAQ | Best fit |
| Hosted payment page (redirect) | The customer is redirected to a page hosted by the provider | Low | SAQ A | Fast launch, small teams |
| Embedded fields (iframe) | Provider-hosted card fields sit inside your page | Medium–high | SAQ A, if your site meets the script eligibility criterion | Branded checkout without card data on your servers |
| JavaScript form or direct post | Your page renders the form; card data goes from the browser to the provider | High | SAQ A-EP | Rarely the best choice in 2026 |
| Direct API (server-to-server) | Your servers receive card data and call the gateway API | Full | SAQ D | Payment companies and enterprises with a mature security program |
The PCI Security Standards Council explains why direct post falls under SAQ A-EP while iframes and redirects fall under SAQ A: in a direct-post setup, the merchant’s page controls how card data leaves the browser. The final SAQ depends on your exact implementation, so confirm it with your Qualified Security Assessor (QSA) or acquirer.
Hosted payment gateway
It is the most popular type of payment gateway. Hosted solutions are provided by third-party payment companies. To complete a payment, the user is redirected to the provider’s page, or enters card details into provider-hosted fields embedded in your checkout.
Let’s check the benefits and drawbacks of this payment gateway type.
| Pros | Cons |
| Stress-free integration of a payment gateway | Complete dependence on a third party |
| Payment is processed by a third party | Limited UI customization options (less so with embedded fields) |
| Data security is largely ensured by the vendor | With a redirect, users leave your site to complete a payment |
Non-hosted payment gateway
This type of payment gateway needs website owners to collect payment data on their own pages or servers. Users share their card details directly on your website, without being redirected. The Payment Card Industry Data Security Standard (PCI DSS) applies to this setup in full or near-full scope.
Let’s explore the advantages and downsides of non-hosted solutions.
| Pros | Cons |
| Users don’t get redirected to a vendor’s site to complete a payment | The website and backend fall into a much larger PCI DSS scope |
| The design of a checkout form is fully customizable | The website owner is responsible for maintaining a high level of data security |
Non-hosted payment gateways are usually used by large enterprises and payment companies that process a significant number of transactions and run their own security programs.
PCI DSS 4.0.1: why your payment page is now in security scope
Since 31 March 2025, PCI DSS v4.0.1 Requirements 6.4.3 and 11.6.1 are mandatory. They had been best practices since 2022 and became required on that date:
- Requirement 6.4.3: every script loaded and executed on the payment page in the customer’s browser must be authorized, checked for integrity and listed in an inventory with a business or technical justification.
- Requirement 11.6.1: a change- and tamper-detection mechanism must alert you to unauthorized changes to the security-impacting HTTP headers and the script contents of the payment page as the customer’s browser receives them, at least weekly or at a frequency set by your targeted risk analysis.
The reason is e-skimming. In 2018, attackers got into British Airways’ systems and planted a card skimmer on the airline’s payments page. The personal data of approximately 429,612 customers and staff was harvested, the attack went undetected for over two months, and the UK Information Commissioner’s Office fined the airline £20 million. The payment provider was never the weak point. A modified script on the merchant’s own page was.
In January 2025, the Council simplified SAQ A: it removed Requirements 6.4.3 and 11.6.1 from the questionnaire and added an eligibility criterion instead. Merchants now confirm that their site is not susceptible to attacks from scripts that could affect their e-commerce systems.
FAQ 1588, published by the Council in February 2025, clarifies that the criterion applies to the webpage that hosts a provider’s embedded payment form, such as an iframe, and not to a full redirect. Merchants can meet it by protecting that page with controls like those in 6.4.3 and 11.6.1, or by obtaining confirmation from the payment provider that its embedded solution includes such protection.
What this means in practice:
- A redirect keeps your scope smallest. The payment page belongs to the provider.
- An iframe still needs script control on your page: a script inventory, a Content Security Policy, and monitoring for unauthorized changes — or written confirmation from your payment provider that its embedded form includes such protection.
- JavaScript forms and direct post are hard to justify in 2026. They bring a much larger SAQ for a checkout that embedded fields can usually match.
Popular payment gateways
These days, there is a large assortment of payment gateways on the market. Widely used options for websites and apps include PayPal, Stripe, Amazon Pay and Braintree (owned by PayPal), as well as buy-now-pay-later services such as Afterpay. Enterprise merchants also work with global acquirers and gateways such as Adyen and Worldpay.
Hosted solutions remain the most common choice because of hassle-free integration and maintenance. The right gateway depends less on popularity than on your markets, payment methods and integration method.
How to choose a payment gateway
Feel free to research the Internet and shortlist payment gateways that meet your needs. Then assess them using the criteria below.
1. Choose the integration method first
Analyze your needs and define the integration method that fits your requirements. You can check the use scenarios below.
| Use scenario | Best solution |
| A small business needs an affordable way to accept payments quickly | Hosted payment page (redirect) |
| You want a branded checkout without card data touching your servers | Embedded fields (iframe) with script controls |
| You are unable to maintain a high level of data security or a large PCI DSS scope | Hosted page or embedded fields |
| You want customers to complete payments without leaving your site to reduce cart abandonment | Embedded fields (iframe) |
| You are a payment company or need full control of the transaction flow | Direct API, with a full PCI DSS program |
| You plan to sell through several channels, including mobile apps and AI agents | An API-first gateway with tokenization and server-side event handling |
2. Assess gateway security
It’s vital to select a gateway that will keep your customers’ payment data safe. The most important security features to check are:
- Data encryption — sensitive data is transformed into a form that can only be read with a secret key.
- PCI DSS compliance — ask the provider for its PCI DSS Attestation of Compliance as a service provider. Your own scope depends on the integration method above.
- Fraud detection — tools that verify card or wallet owners and score transactions to prevent unauthorized payments.
- Multi-factor authentication (MFA) — for your team’s access to the gateway dashboard and API keys.
- Tokenization — sensitive card data is replaced with tokens that have no mathematical relation to the original data. Per the PCI SSC tokenization guidelines, tokenization may reduce the scope of your cardholder data environment.
- 3D Secure — an additional verification step by the issuing bank. In the EU and UK, it supports Strong Customer Authentication requirements.
- TLS encryption — the modern successor of SSL, which protects data between the user’s browser and the server.
3. Check payment gateway features
Many payment gateways offer distinctive features that bring helpful functionality. The top features to check are:
- Payment processor integration — most popular gateways have built-in processors. If a gateway does not, the processor needs to be integrated separately.
- Recurring billing — automated billing that lets businesses create subscriptions and charge customers on a defined schedule.
- Reporting and reconciliation — dashboards and settlement reports that let finance match payouts with orders.
- Customized UI elements — custom buttons and hosted payment forms that match your interface.
- API and webhooks quality — clear documentation, versioning and signed event notifications. This is what your developers will live with for years.
4. Compare pricing
Explore the pricing policies of payment gateway providers to understand how much you will pay. Most providers charge a percentage plus a fixed fee per successful transaction. For example, standard US online rates are 2.9% + 30¢ per domestic card transaction at Stripe and 3.49% + a fixed fee for PayPal Checkout, where the fixed fee is $0.49 for US dollar payments.
International cards, currency conversion and chargebacks usually add separate fees. Large merchants often negotiate custom or interchange-plus pricing. Check the current rates of every shortlisted provider on its pricing page before you compare totals.
5. Assess the quality of support
Sometimes unforeseen issues occur and a payment gateway stops working. Technical problems can block your ability to accept payments.
Choose a vendor that resolves technical issues fast. Examine support hours, check whether the provider runs a public status page, and contact its team to gauge response time.
6. Check transaction limits
Payment gateway providers set transaction and volume limits. Check them before you select a solution, so that your account is not suspended and transactions are not blocked when your volume grows. Limits change often and depend on your account verification, so confirm them with the provider for your business.
7. Check supported countries, currencies and payment networks
Research the countries, currencies and card networks each shortlisted gateway supports, as well as local payment methods your customers expect. Coverage changes regularly, so rely on the providers’ current documentation rather than third-party lists.
8. Consider mobile payment support
If you want customers to complete payments in a few taps on their smartphones, choose a gateway that supports mobile wallets. The most widespread solutions are Apple Pay, Google Pay and Samsung Pay.
9. Check how portable your data is
Ask how you can leave. If you switch providers or add a second one, can stored card tokens and subscriptions be migrated? Lock-in at this level is expensive to undo later.
How to integrate a payment gateway in a website: step by step

The payment gateway integration roadmap includes four stages:
- Preparation
- Solution configuration
- Server-side event handling
- Testing and go-live
Let’s explore all the stages in more detail.
1. Prepare to integrate a payment gateway
For starters, you need to prepare for a smooth payment gateway integration. Take the following steps.
- Select a gateway and an integration method. Analyze shortlisted gateways using the criteria above, and decide how the payment form will be rendered. This decision sets your PCI DSS scope, so make it before development starts.
- Map the payment data flow. Draw where card data enters, which systems see tokens, and which scripts load on the checkout page. This map is what your QSA or acquirer will ask for.
- Enable HTTPS everywhere. All websites that collect and transfer payment and other sensitive information must use TLS (the successor of SSL). Make sure your website is accessible via HTTPS only; otherwise configure 301 redirects so that all users land on the secure version of your site.
- Get a merchant account. Contact your bank or payment provider to open a merchant account. You may need to provide evidence that your business is legitimate. Some providers, such as Stripe and PayPal, let you start accepting payments without opening a separate merchant account at a bank.
- Onboard developers. Depending on the chosen gateway, you may need to update the codebase of your site, configure an API integration, or build a complete non-hosted solution. Explore the gateway documentation and onboard software engineers with the required expertise.
2. Configure a payment gateway
Having chosen a payment gateway, follow its detailed instructions so you don’t fail when configuring new functionality. Here are the official instructions for the three most popular payment gateways:
Let’s check how to integrate the most popular payment gateways into a website in more detail.
PayPal. It is one of the most widely used payment gateways for businesses. For starters, you need to create a PayPal business account. Then you choose one of two integration options.
Standard PayPal button. It is a quick and hassle-free way to integrate a payment gateway into a website, suitable for teams with limited technical skills:
- Open the PayPal integration builder.
- Configure the button’s design and functionality.
- Copy the generated code.
- Paste the code on your site.
- Add the JavaScript SDK code to the checkout page and adjust it.
Advanced checkout. This option needs a PayPal API integration. Customers don’t leave your website to pay by card. The integration steps are:
- Enable card payments in your PayPal account.
- Generate a client token.
- Add the PayPal JavaScript SDK and PayPal button to your site.
- Create API endpoints on your server.
- Add a checkout form and connect it to the created API endpoints.
Stripe. Stripe offers rich documentation, a low-code hosted checkout and embedded payment components. It also supports Apple Pay and Google Pay on the web. A typical Stripe integration includes:
- Server setup.
- Checkout page or embedded form.
- Payment form completion and error handling.
- Post-payment event handling.
Amazon Pay. Amazon Pay lets customers pay with the details stored in their Amazon accounts. There are two widespread ways to configure it.
Pre-built plugins. Many e-commerce platforms and content management systems (CMSs) offer Amazon Pay plugins. If your site is built on such a platform, check whether a plugin exists and follow its instructions to enable the payment gateway in a few clicks.
Custom integration. If you have a custom-built website or there is no plugin, the integration typically follows these steps:
- Set up the required software components.
- Add the Amazon Pay button.
- Display shipping and payment information.
- Configure payment information.
- Complete the checkout and add shipment tracking information.
- Manage recurring payments (an additional step for subscriptions).
- Manage refunds.
- Test the payment integration.
- Make your integration live.
3. Payment gateway API integration: handle events on the server
This is the stage most guides skip, and the one where most production problems appear. A payment is not complete when the customer clicks “Pay”: the gateway confirms the result asynchronously, through webhooks.
A reliable integration needs four things:
- Verify every webhook signature before you process the event. Providers sign events so that attackers cannot forge a “payment succeeded” message. Stripe, for example, requires the raw request body for verification.
- Make event handlers idempotent. The same event may be delivered more than once. Store event IDs and skip duplicates, otherwise customers can get two orders or two subscriptions.
- Don’t rely on event order. Fetch the current state of a payment from the API when the order of events matters.
- Reconcile daily. Compare orders in your system with the gateway’s settlement reports, so finance finds discrepancies before customers do.
If your sales or support teams work in a CRM, connect it here. Payment events update the customer record, show payment status on the deal, and trigger workflows such as a support ticket after a failed payment. Store only tokens, transaction IDs, amounts and statuses in the CRM — never full card numbers.
4. Test and go live
A sandbox, also known as a testing environment, isolates tested code to make sure everything works as designed before going live. Developers simulate payments to check how the integrated gateway works under different circumstances, using the test card numbers each provider publishes. Feel free to learn more:
Test more than successful payments: declined cards, 3D Secure challenges, refunds, partial refunds, chargebacks and delayed or repeated webhooks. After that, move your solution to the live environment and make a few real low-value payments to make sure customers won’t experience any issues.
If you integrate a feature-rich payment solution, involve quality assurance (QA) engineers. They will help ensure that the integrated payment flow works correctly across browsers, devices and edge cases.
How to integrate multiple payment gateways
Many businesses add several payment gateways to offer more payment options and to keep selling when one provider is down.
The second reason became very concrete in 2025. On 21 April 2025, Adyen reported a DDoS attack that impacted the availability of several of its payment services in the European region. For merchants with a single provider, this meant stopped sales: ticketing platform TicketCo described a critical disruption of the entire purchase flow on its platform. Even the most reliable providers have incidents. The question is what your checkout does when one happens.
There are three ways to integrate multiple payment gateways:
| Approach | How it works | Trade-offs |
| CMS or e-commerce plugins | Each gateway is a separate plugin; customers choose a method at checkout | Fast, but no automatic failover or routing |
| Abstraction layer in your backend | Your code wraps several gateway APIs behind one internal interface | Full control; your team maintains every integration |
| Payment orchestration platform | A third-party layer routes transactions between providers by rules | Failover and routing out of the box; another vendor and fee in the chain |
Earlier, multiple gateway integrations on a website could not be interconnected: customers simply chose a preferred payment method. With an abstraction layer or an orchestration platform, a transaction declined or failed at one provider can be retried at another, and traffic can be routed by country, card type or cost. Keep in mind that stored card tokens are provider-specific, so plan token portability before you depend on failover for recurring payments.
How to integrate a payment gateway in a mobile application
Integrating a payment gateway into a mobile app is a more complicated process that needs skilled software engineers. They integrate a software development kit (SDK) provided by the vendor and set up the checkout functionality. Use the provider’s native payment components and mobile wallets, so card data is collected inside the SDK and never by your own app code.
Since the integration instructions vary, check the official guides for the most popular solutions:
- PayPal: iOS / Android
- Stripe: iOS / Android / React Native
- Amazon Pay: iOS / Android / custom API integration
Let’s check how to integrate a payment gateway into a mobile application using the PayPal SDK for iOS as an example:
- Get prepared to integrate the SDK.
- Enable the iOS PayPal SDK.
- Add the iOS PayPal SDK to your app.
- Configure the iOS PayPal SDK.
- Integrate the SDK (client-side or server-side integration type).
- Create and capture orders.
- Complete test purchases using sandbox accounts.
Before you build in-app payments, check app store rules for your product type. Apple and Google apply different rules to physical goods and to digital goods and subscriptions.
How AI agents change payment gateway integration
In 2025–2026, the largest payment and technology companies released open protocols that let AI agents complete purchases for buyers:
- Agentic Commerce Protocol (ACP). In September 2025, Stripe and OpenAI released ACP and launched Instant Checkout in ChatGPT.
- Agent Payments Protocol (AP2). Also in September 2025, Google announced AP2 with more than 60 partners. It uses cryptographically signed “mandates” as proof of what the user authorized.
- Universal Commerce Protocol (UCP). In January 2026, Google introduced UCP, which covers the shopping flow and uses AP2 for payments.
- Visa Intelligent Commerce Connect. In April 2026, Visa announced a single integration for payment initiation, tokenization, spend controls and authentication in agent-led purchases, starting as a pilot with select partners.
The shift has already reached merchant pricing: PayPal’s US merchant fee schedule lists a separate line for “PayPal Checkout – Agentic Virtual Card”.
What does it mean for your integration? An AI agent does not click a button on your checkout page. It calls APIs, presents tokenized credentials and expects machine-readable product, price and order data. A payment integration built server-side, with tokenization and clean order and event APIs, can add a new channel through your gateway or an orchestration partner. A checkout that exists only as front-end code on one web page will need to be rebuilt.
Practical steps for 2026:
- Don’t build for one protocol yet. Standards are still converging; ask your gateway which protocols it supports and plan to connect through it.
- Make your catalog and order flow accessible via API, with accurate prices, availability and order status.
- Keep your controls on agent traffic: fraud rules, spend limits and clear logging of which agent initiated which order.
How much does payment gateway integration cost?
The total cost has two parts: provider fees and integration effort.
Provider fees are per transaction, as described in the pricing section above. Integration effort depends on a few factors:
- Integration method. A hosted page is the fastest to implement; a direct API integration also brings a full PCI DSS program.
- Number of gateways and platforms. Web, iOS and Android, plus every additional provider, multiply the work.
- Checkout customization. Embedded fields, custom flows and local payment methods add development and testing.
- Subscriptions, refunds and reconciliation. Recurring billing and finance reporting are often larger than the checkout itself.
- Integrations with internal systems. CRM, ERP, order management and accounting.
- Security and compliance. Script controls for embedded forms, penetration testing and assessment preparation.
CodeIT expertise in payment gateway integration
Our engineers have integrated payment gateways into web and mobile products, from subscription apps and online marketplaces to fintech software such as a CRM for payment processors. Check out some of the projects completed by the CodeIT team.
CRM system for payment processors. CodeIT has worked with a US-based client since 2019 on a cloud CRM with payment processing for independent sales organizations (ISOs). The platform serves 400,000+ active merchants and processes over $3.5 billion in monthly sales. Read the case study.
Brewed. Brewed is a subscription-based portal that connects bars and beer lovers. Our team developed web, iOS and Android applications that help users explore beer types and find bars, breweries and events. Bars and breweries pay recurring fees to list their businesses in the app, so our engineers integrated the PayPal payment gateway and configured it to charge recurring payments.
GIObikes. GIObikes is an e-commerce website for selling bikes and recreational equipment, with online auctions, an inventory management system, integrated shipping services and multiple payment options. Our experts implemented the following payment methods:
- Debit or credit card — users enter card details to make a payment.
- PayPal checkout — customers pay with their PayPal accounts; the PayPal button redirects users to the vendor’s site to complete the transaction.
- PayPal Credit (formerly Bill Me Later) — customers pay with their PayPal credit line.
- Money order or bank wire — accepted as payment for goods.
Final words
The integration of a payment gateway depends on your business needs and the chosen solution. Research carefully, and choose the integration method before the gateway brand: it decides your PCI DSS scope, your checkout experience and how easily you can add new channels.
The easiest way to integrate a payment solution is to configure a pre-built CMS plugin or add a PayPal button. The PayPal button process involves configuring the button in the PayPal builder, pasting the generated code, and integrating the JavaScript SDK.
For most businesses beyond a simple store, you will need software engineers. They review the gateway documentation, integrate SDKs, configure API integrations, handle webhooks and connect payments to your internal systems.
If you are planning a new checkout, adding a second gateway or preparing for agent-led purchases, CodeIT can help through API Development & Systems Integration and a Security Assessment & Technical Risk Review of your payment flow. Contact us to discuss your case.
FAQ
Payment gateway integration is the process of connecting a website or app to a provider that securely collects, encrypts and authorizes payments. It covers the checkout form, the server-side logic that confirms payments, and the connection to your internal systems.
It lets a business accept card and wallet payments online and receive the money on its merchant account. The way you integrate also decides your security and compliance obligations, so a poor integration can create data-exposure risk even when the gateway itself is secure.
The gateway collects the customer’s payment details, encrypts them and passes them to a processor. The processor sends the request through the card network to the issuing bank, which approves or declines it, and the gateway notifies your system of the result.
Many providers have no setup or monthly fee on standard plans, but they charge a fee for every successful transaction — for example, 2.9% + 30¢ for domestic cards at Stripe in the US. Development work to integrate and maintain the gateway is a separate cost.
It depends on the integration method, the number of gateways and platforms, checkout customization, subscriptions and internal-system integrations. A hosted page with a plugin is the lowest-effort option; a multi-gateway, API-first integration is the highest.
Choose a gateway and an integration method, enable HTTPS, open a merchant account, configure the gateway following its documentation, handle payment webhooks on your server, and test everything in the sandbox before going live. On a CMS, a pre-built plugin can cover most of these steps.
Use the provider’s official mobile SDK for iOS, Android or a cross-platform framework, add mobile wallets such as Apple Pay and Google Pay, and process payments on your server. Check app store rules for digital goods before you build.
You can, but your systems will store, process or transmit card data, which brings a full PCI DSS assessment and contracts with acquiring banks. For most businesses, integrating an existing gateway — or several through an orchestration layer — is faster and less risky.
There is no single best gateway. Shortlist providers that support your countries, currencies and payment methods, then compare integration options, PCI DSS scope, fees, API quality and support. For a fast launch, a hosted checkout from a widely used provider is usually enough; for several markets or channels, prioritize API quality and token portability.
The gateway collects and encrypts payment details and passes them on; the processor moves the transaction through the card network to the issuing bank and back. Many providers offer both in one service, which is why the terms are often used interchangeably.
Build your ideal
software today

