software development
What is a Payment Gateway? A Developer's Guide to Payment Processing
A payment gateway processes online payments securely via providers like Stripe and Mollie. Learn how PCI compliance, webhooks, recurring billing, and checkout integration work in practice.

What is Payment Gateway?
A payment gateway is a service that facilitates online payments between customer and merchant by authorizing, validating, and routing transactions to payment processors. The gateway communicates with card networks like Visa and Mastercard, local payment methods such as iDEAL and Bancontact, and digital wallets including Apple Pay. Developers integrate payment gateways through REST APIs, SDKs, or hosted checkout pages, depending on the desired level of control and PCI compliance scope.
How does Payment Gateway work technically?
The payment flow of a gateway proceeds through multiple stages. The customer initiates a payment on the website or app. The gateway encrypts the payment data and sends an authorization request to the payment processor, which communicates with the card network or issuing bank. Upon approval, the merchant receives an authorization code and the amount is reserved. The actual charge (capture) follows upon shipment or confirmation. PCI DSS (Payment Card Industry Data Security Standard) governs how organizations handle card data. The simplest compliance route is using hosted checkout or pre-built elements (Stripe Elements, Mollie Components) so card data never touches your servers. This reduces PCI scope to SAQ A, the lowest compliance level. Modern gateways support diverse payment models: one-time payments, recurring subscriptions with automatic collection, usage-based billing, and split payments for marketplaces. Stripe Billing and Mollie Subscriptions automate subscription logic including prorations on upgrade or downgrade, dunning management for failed payments, and tax calculation per region. Webhooks are essential for reliable payment processing. Instead of polling for status updates, the gateway sends an HTTP POST to your server on every status change. Critical webhook events include payment_intent.succeeded, invoice.paid, and charge.refunded. Webhooks must be processed idempotently to prevent duplicate processing during retries. The choice between gateways depends on several factors: geographic coverage, supported payment methods, transaction fees, API documentation quality, and availability of sandbox environments for testing. Stripe offers the broadest API and best developer experience. Mollie has strong local payment methods in the Benelux. Adyen targets enterprise with omnichannel support.
How does MG Software apply Payment Gateway in practice?
MG Software integrates Stripe and Mollie into e-commerce platforms and SaaS products. For checkout, we use Stripe Elements or Stripe Checkout, ensuring card data never reaches our servers and PCI compliance is maintained with minimal complexity. For subscription-based SaaS, we implement Stripe Billing with webhooks that automatically synchronize payment statuses with our database. Upgrades, downgrades, and prorations are handled by Stripe, saving weeks of custom billing logic development. For Dutch e-commerce projects, we often choose Mollie for its excellent iDEAL integration and the trust Dutch consumers place in the brand. Mollie's webhook architecture is similar to Stripe's, making our integration patterns reusable across providers. For marketplace projects, we use Stripe Connect to automatically split payments between the platform and sellers, including automated payouts and tax reporting compliance.
Why does Payment Gateway matter?
A reliable payment gateway is the backbone of any e-commerce or SaaS revenue model. The choice of gateway directly affects conversion rates, geographic reach, and customer trust. A smooth checkout experience with local payment methods can make the difference between a completed and an abandoned transaction. For SaaS businesses, integration with subscription management is critical. Automatic recurring billing, dunning management for failed payments, and self-service portals for customers to manage their subscriptions reduce churn and increase lifetime value. Investing in robust payment infrastructure pays back directly through higher revenue and lower operational costs for the billing team.
Common mistakes with Payment Gateway
The most dangerous mistake is storing payment data locally instead of using hosted checkout or pre-built elements. This violates PCI DSS compliance and creates a significant security liability. Always use the hosted solutions from your gateway so card data never touches your own systems or databases. A second frequent error is not processing webhooks idempotently. Gateways resend webhooks on timeouts or errors, which without idempotency keys leads to duplicate orders or charges. Store the webhook ID and check on every receipt whether the event has already been processed. Log all webhook events for debugging and audit compliance purposes.
What are some examples of Payment Gateway?
- An online store with Mollie checkout where the customer chooses from iDEAL, credit card, or Apple Pay. After payment, the server receives a webhook that updates order status, triggers a confirmation email via Resend, and automatically adjusts inventory levels.
- A SaaS platform with Stripe Subscriptions that bills automatically each month. Upgrades and downgrades are processed in real-time with automatic prorations, and failed payments trigger a dunning flow that reminds customers via email to update their payment method.
- A marketplace using Stripe Connect to automatically split payments between the platform and individual sellers. Each seller has their own Stripe account and receives automated payouts according to a configurable schedule.
- A donation platform with Stripe Payment Links that becomes operational in minutes without custom checkout code. Donors choose their amount, pay via their preferred method, and receive an automatic tax receipt generated through webhook processing.
- A B2B platform with Stripe Invoicing that generates and sends invoices to business customers. Payments are automatically matched against outstanding invoices, and reminders follow a configurable dunning schedule with escalating urgency levels.
Related terms
Further reading
Frequently asked questions
Do I need to be PCI DSS compliant?
If you process or store credit card data, yes. The simplest path to compliance is using hosted checkout (Stripe Checkout, Mollie) or pre-built elements (Stripe Elements). This ensures card data never reaches your servers, reducing your PCI scope to the lowest level (SAQ A). This saves tens of thousands in audit and compliance costs compared to handling card data directly on your own infrastructure.
Stripe or Mollie for Dutch customers?
Mollie has strong iDEAL and Bancontact integration and enjoys local trust among Dutch and Belgian consumers. Stripe offers broader international coverage, better subscription tooling, and a more extensive API surface. Both are solid choices. For pure Dutch e-commerce, Mollie is often the first choice. For international SaaS with recurring billing, Stripe is typically better suited thanks to Stripe Billing.
How do I process webhooks securely?
Always verify the cryptographic signature that Stripe and Mollie include with every webhook event. Use idempotency keys to prevent duplicate processing during retries. Process webhooks asynchronously via a queue to avoid timeouts. Return a 200 status code immediately to the gateway and process the event in the background. Log all events for debugging and compliance audit trails.
What does a payment gateway cost per transaction?
Stripe typically charges 1.5% plus 0.25 EUR for European card transactions, and 2.9% plus 0.25 EUR for non-European cards. Mollie charges per payment method: iDEAL costs a flat 0.29 EUR per transaction. At high volume, negotiated rates are available from both providers. Always calculate total transaction costs including refunds, chargebacks, and currency conversion for your business case before committing.
How do I implement recurring billing for SaaS?
Stripe Billing provides a complete subscription management solution. You define products and pricing plans, attach customers to subscriptions, and Stripe handles automatic collection, prorations on plan changes, and dunning for failed payments. Webhooks synchronize payment status with your database in real-time. For the Dutch market, Mollie offers similar subscription functionality with iDEAL as the primary payment method.
What is Stripe Connect and when do I need it?
Stripe Connect is designed for platforms and marketplaces that split payments between multiple parties. It offers three models: Standard (sellers manage their own Stripe account), Express (simplified onboarding), and Custom (fully integrated white-label experience). You need Connect when your platform receives payments on behalf of third parties and must distribute them automatically, including platform commission and tax reporting.
How do you handle failed payments?
Implement a dunning strategy that automatically retries collection after a failed payment. Stripe Smart Retries uses machine learning to determine the optimal moment for a retry attempt. Send customers an email with a link to update their payment method. After multiple failed attempts, pause or cancel the subscription. Monitor your failed payment rate as a key business metric alongside churn.
This concept in your system?
We work with this every day. In a one-hour conversation you know whether it is a portal, an integration or a rebuild.
