Top examples of 3 practical examples of integrating payment gateways in 2025
Let’s start with the most familiar pattern: a single-vendor online store charging a customer once for a cart. This is the simplest example of integrating a payment gateway, and it’s the pattern everything else builds on.
A very common stack in 2025 looks like this:
- Frontend: React, Vue, or Next.js
- Backend: Node.js, Python (Django/FastAPI), Ruby on Rails, or Java/Spring
- Gateway: Stripe, Braintree, or Adyen
In this first of our examples of 3 practical examples of integrating payment gateways, the flow usually looks like:
- Customer reviews cart and clicks Checkout.
- Frontend calls your backend to create a payment intent or order with the gateway.
- Backend talks to the payment gateway API and returns a client token or payment ID.
- Frontend renders a hosted payment form or card element using that token.
- Customer enters card details or chooses a wallet (Apple Pay, Google Pay, PayPal).
- Gateway handles authentication (3D Secure / SCA) if needed.
- Gateway confirms the payment and notifies your backend via webhook.
- Your backend marks the order as paid and triggers fulfillment.
Why this is one of the best examples of integrating payment gateways
This pattern is boring in the best way. It’s predictable, it’s battle-tested, and it aligns with how major gateways want you to integrate in 2025. Stripe’s own docs show virtually this exact flow for Payment Intents and recommend webhooks as the source of truth for successful payments.
A few practical details that separate solid integrations from flaky ones:
- Idempotency keys on backend calls to the gateway, so a retried request doesn’t double-charge a card.
- Order state machine in your database:
pending → payment_processing → paid → fulfilled → refunded. Don’t just use a boolean. - Webhook verification using the gateway’s signing secret to avoid spoofed notifications.
- Graceful declines: decline codes mapped to user-friendly messages instead of “Payment error.”
If you want real examples, Stripe, Braintree, and Adyen all provide open-source sample apps on GitHub that mirror this pattern. These are some of the best examples to crib from when you’re designing your own integration.
2. Marketplace and platform payments: real examples of split payouts and multi-party flows
Once you introduce multiple sellers—think Etsy, Uber, or Airbnb-style platforms—your integration changes dramatically. You’re no longer just charging a customer; you’re routing funds between multiple parties, handling fees, and dealing with compliance.
This second scenario is where examples of 3 practical examples of integrating payment gateways really start to earn their keep, because the logic is less obvious and the mistakes are expensive.
A typical marketplace integration with Stripe Connect or PayPal for Marketplaces works like this:
- The platform onboards sellers as connected accounts.
- Customers pay the platform, not the individual seller.
- The platform takes a fee and pays out the remainder to the seller’s bank account.
A concrete flow: booking marketplace
Imagine a service marketplace where customers book a professional (tutor, designer, consultant). Here’s how one of the real examples of marketplace integrations plays out:
- Customer selects a provider and books a session for $200.
- Your backend creates a payment intent for $200 with metadata that includes the provider’s account ID.
- The gateway collects the payment from the customer.
- After the session is completed, your backend triggers a transfer: \(170 to the provider, \)30 platform fee.
Gateways like Stripe and Adyen provide explicit support for this pattern. Stripe’s Connect documentation shows examples of destination charges and separate charges and transfers, while Adyen’s MarketPay offers similar constructs.
2024–2025 trends you need to care about
Marketplaces are under heavier scrutiny around:
- Know Your Customer (KYC) checks for sellers
- Tax reporting (for example, U.S. 1099-K thresholds tightening again after being delayed)
- Platform liability for chargebacks and fraud
Regulators like the U.S. Consumer Financial Protection Bureau (CFPB) and the IRS publish ongoing guidance on payments and reporting; for a general sense of regulatory context, you can start with the IRS’s information on payment card and third-party network transactions at IRS.gov.
From an integration guide perspective, that means:
- You must store seller verification status and block payouts until KYC is complete.
- You need clear mapping from payment events (charge, refund, dispute) to payout adjustments.
- Webhooks become even more important because payouts and disputes can happen days or weeks after the original charge.
This marketplace scenario is one of the best examples of integrating payment gateways in a way that goes beyond “charge a card” and into real platform economics.
3. Subscription SaaS: recurring billing as a practical example of payment gateway integration
The third of our examples of 3 practical examples of integrating payment gateways is the subscription model: think Netflix, a developer SaaS tool, or a newsletter platform.
Here you’re not just collecting a one-time payment. You’re:
- Managing recurring charges
- Handling upgrades, downgrades, and proration
- Dealing with expired cards and failed renewals
Gateways like Stripe Billing, Braintree Subscriptions, and Recurly specialize in this. A typical integration looks like this:
- Customer picks a plan and enters payment details.
- Your backend creates a customer object and a subscription with the gateway.
- The gateway handles recurring billing according to the schedule (monthly, yearly, etc.).
- Webhooks inform your system when invoices are paid, failed, or canceled.
Real-world subscription example of integrating payment gateways
Picture a SaaS app with three tiers: Free, Pro, and Enterprise.
- On signup, a user chooses Pro Monthly.
- Your backend creates a customer and a subscription with a trial period.
- When the trial ends, the gateway automatically charges the card.
- If the charge fails, the gateway runs a dunning process (retry logic, emails).
- Your app listens for
invoice.payment_succeededandinvoice.payment_failedevents. - On success, you keep access; on repeated failures, you downgrade or lock the account.
This is a great example of how you offload recurring logic to the gateway while keeping your own system focused on entitlement and access control.
For broader context on recurring billing and churn behavior, academic and industry research on subscription economics is helpful. For instance, Harvard Business School has published multiple analyses on subscription models and retention dynamics; see Harvard University’s open-access resources for background on how subscription revenue behaves over time.
Extending beyond the 3: more real examples of integrating payment gateways
Those three patterns cover most products, but in practice you’ll mix and match them. To make this guide more than just examples of 3 practical examples of integrating payment gateways, let’s look at additional real examples you’re likely to encounter.
Digital wallets and one-click checkout
Wallets like Apple Pay, Google Pay, and PayPal are no longer “nice to have.” In the U.S., multiple industry reports show digital wallets taking a growing share of e‑commerce payments through 2024, especially on mobile.
From an integration standpoint, you’re still using the same gateway, but you:
- Enable wallet methods in the gateway dashboard.
- Add wallet-specific buttons on the frontend.
- Let the gateway tokenize the wallet and return a payment method.
This is essentially a variation of the e‑commerce example of integrating a payment gateway, but with different payment method types and some extra validation rules (like domain verification for Apple Pay).
Buy Now, Pay Later (BNPL)
BNPL providers (Affirm, Klarna, Afterpay, and gateway-native options from Stripe or PayPal) continue to grow, particularly for higher-ticket consumer purchases. Research from regulators and consumer protection agencies has raised concerns about overuse and transparency, which is why many gateways now include clearer disclosures and repayment schedules.
Your integration pattern:
- Offer BNPL as a payment method via your existing gateway.
- The gateway or BNPL provider underwrites the customer in real time.
- You get paid upfront; the customer repays the BNPL provider over time.
From your code’s perspective, this is another example of a payment method variation on top of the same core gateway integration.
For consumer-risk context, the U.S. Consumer Financial Protection Bureau (CFPB) publishes research and guidance on BNPL and other credit products at consumerfinance.gov.
In‑app and mobile payments
If you’re building native iOS or Android apps, you’ll often integrate:
- In-app purchases (Apple/Google billing) for digital goods
- A third-party gateway SDK for physical goods or services
Here the gateway integration often uses mobile SDKs instead of pure REST calls, but the pattern is similar to our earlier examples of 3 practical examples of integrating payment gateways:
- Get a client token from your backend
- Initialize the SDK
- Collect payment details or trigger a wallet
- Confirm payment and sync via webhooks
Patterns that show up across all examples of integrating payment gateways
Across all these scenarios—the three main ones and the additional real examples—some patterns repeat. If you’re building or reviewing an integration guide, these are the things you want to make absolutely clear.
Webhooks as the system of record
In every example of a solid payment integration, webhooks are treated as the authoritative source of truth for payment state. Client-side success messages are nice, but they can be faked or interrupted. Your backend should:
- Accept webhook events from the gateway
- Verify signatures
- Update order or subscription status based on those events
Idempotency and retry logic
Network calls fail. Users double-click buttons. Gateways retry webhooks. The best examples of integrating payment gateways all:
- Use idempotency keys on outbound API calls
- Store processed webhook IDs to avoid double-processing
- Design state transitions so that reprocessing the same event is safe
Security and compliance basics
Even if you never touch raw card numbers (and you shouldn’t), you still have obligations around security. While healthcare-focused resources like HIPAA guidance at HHS.gov are about medical data rather than payments, they illustrate how U.S. regulators think about data protection and breach notification.
For payments specifically, follow PCI DSS guidance from your gateway, and:
- Use hosted fields or tokenization so card data never hits your servers.
- Enforce HTTPS everywhere.
- Rotate API keys and restrict them by environment.
These patterns underpin all the examples of 3 practical examples of integrating payment gateways we’ve covered.
Putting it all together: choosing the right pattern for your product
By now, you’ve seen multiple real examples of integrating payment gateways:
- The straightforward e‑commerce checkout
- The multi-party marketplace with split payouts
- The recurring subscription SaaS model
- Wallets, BNPL, and mobile SDK variations layered on top
The right integration for you is almost always a combination:
- A SaaS platform with a marketplace component might mix subscription billing for platform fees with marketplace payouts to providers.
- A retail brand might combine one-time checkout with BNPL and wallets for better conversion on mobile.
When you design your own integration, it helps to start by mapping your product to one of these patterns and then adapting. That’s why real, grounded examples of 3 practical examples of integrating payment gateways are so valuable—they give you a template, not just an API reference.
FAQ: common questions about real examples of integrating payment gateways
Q1. What are the most common examples of integrating payment gateways for small businesses?
For small online stores, the most common examples include a basic hosted checkout page from Stripe, PayPal, or Square; a plugin-based integration into platforms like Shopify or WooCommerce; and a simple custom checkout page backed by a gateway API. All three follow the same pattern: create a payment object on the backend, redirect or render a secure payment form, then confirm via webhook.
Q2. Can you give an example of a payment gateway integration that supports both subscriptions and one-time purchases?
A typical example is a SaaS tool that sells monthly subscriptions but also charges one-time onboarding or setup fees. The integration uses the gateway’s subscription API for recurring charges and the standard payment API for one-time invoices, all under the same customer record. Webhooks keep both subscription status and one-off payments in sync with your own database.
Q3. How do marketplaces handle refunds in these examples of payment gateway integrations?
In marketplace flows, refunds are usually initiated by the platform, not the individual seller. The platform calls the gateway’s refund API for the original transaction, then adjusts any payouts or future payouts to sellers to reflect the refund. The logic is more complex than a single-vendor store, which is why marketplace documentation from gateways often includes detailed real examples of refund and dispute handling.
Q4. Are digital wallets and BNPL separate integrations or part of the same gateway examples?
In most modern setups, wallets and BNPL are just additional payment methods exposed by the same gateway integration. You configure them in the dashboard and update your frontend to show the right buttons. Under the hood, the same order and webhook patterns you saw in the earlier examples of 3 practical examples of integrating payment gateways still apply.
Q5. What’s the safest way to test these real examples of integrating payment gateways?
Use the gateway’s sandbox environment, test cards, and webhook testing tools. Most providers let you simulate success, declines, disputes, and refunds. You want automated tests that exercise each scenario: successful charge, failed charge, partial refund, full refund, and subscription cancellation. That’s how you turn these examples into a stable production integration.
Related Topics
Best examples of linking Microsoft Teams with project management tools in 2025
Real-world examples of implementing Single Sign-On (SSO) that actually work
The best examples of chatbot integration with Slack: practical examples that actually get used
Top examples of 3 practical examples of integrating payment gateways in 2025
Practical examples of connecting Google Analytics with WordPress: 3 examples that actually matter
Real-world examples of integrating third-party libraries in JavaScript
Explore More Integration Guides
Discover more examples and insights in this category.
View All Integration Guides