How a White-Label Payment Gateway Is Architected: Pay-In, Pay-Out, and PCI Scope
A white-label payment gateway is not a bank or an acquirer. It is the software layer between a merchant (or a portfolio of merchants) and the institutions that actually move money: acquiring banks, payment service provid
A white-label payment gateway is not a bank or an acquirer. It is the software layer between a merchant (or a portfolio of merchants) and the institutions that actually move money: acquiring banks, payment service providers (PSPs), card networks, and alternative payment rails.
The gateway accepts a payment request, applies business rules, talks to one or more processors, records the result, and exposes a consistent API and dashboard. Someone else still holds the licence, settlement account, and scheme membership. Keep that boundary clear, and the architecture is easier to reason about.
The moving parts
Most production gateways share a similar shape, even if the product names differ.
- Edge and API layer. Credentials, idempotency keys, validation, rate limits, and TLS. Charges, refunds, and payouts must be retryable without double processing.
- Orchestration and connectors. Routing decides which acquirer or PSP to use, and when to retry or fall back. Each connector translates your canonical payment object into that provider's API or message format.
- Vault and tokenisation. If the gateway ever sees a Primary Account Number (PAN), this is the only place it should persist — and only if a hosted field or direct-to-processor flow cannot avoid it.
- Ledger. Authorisations, captures, refunds, chargebacks, payouts, and fees need an immutable record. Reconciliation and dashboards are built on this.
- Risk, webhooks, and consoles. Velocity checks, 3-D Secure (3DS), and scoring should plug in without rewriting the happy path. Signed webhooks keep merchants in sync. Consoles need role-based access and audit logs, without giving every operator vault access.
Pay-in and pay-out share this chassis, and diverge mainly in the rails they call and the checks required before money leaves.
Pay-in: collecting funds
A typical card pay-in looks like this:
- The customer enters payment details at checkout. Prefer a hosted field or iframe so the merchant application never touches raw PAN or SAD (sensitive authentication data such as the CVV).
- The gateway receives a payment intent: amount, currency, merchant account, token or customer reference, and metadata such as the order id.
- Risk and authentication run. In many regions this includes 3DS; the result is attached to the authorisation.
- The orchestrator picks a connector by contract, cost, approval rate, or downtime, and sends an authorisation.
- On success, the gateway stores an authorisation id, a token (not the PAN), and a state such as
authorized. - Capture may be immediate or delayed until fulfilment. Settlement follows the acquirer's cycle, so the ledger should separate authorised, captured, and settled. Webhooks fire on each state change; refunds and chargebacks re-enter the same state machine.
Alternative methods (UPI, account-to-account, wallets, local APMs) use the same pattern with different connectors and, often, a redirect or QR step. The merchant API should still look similar: create a payment, wait for a terminal status, handle failures explicitly.
Two details cause outsized pain when they are wrong. Idempotency: a client timeout is not a failed payment; the same key must return the original result, not a second charge. Reconciliation: store your internal transaction id, the acquirer's reference, and the merchant's order id so a later settlement file can be matched.
Pay-out: sending funds
Pay-out is not pay-in in reverse. You are pushing money to a beneficiary, which brings different failure modes: bad account details, compliance holds, rail cut-off times, and partial batch failures.
A clean flow usually includes:
- Beneficiary onboarding. Vault account identifiers, validate format, and record the owner and purpose of the payment.
- Pre-flight checks. Sanctions and AML screening, funding or balance checks, limits, and dual control for large amounts.
- Rail selection. Local ACH or NEFT-style transfers, instant rails, card payouts, or a PSP payout API. The connector abstracts the rail; the ledger should not.
- Submission and tracking. Many rails are asynchronous. Model states such as
queued,submitted,accepted,rejected, andreturned, and follow them to a terminal state. - Returns. An accepted payout can still bounce days later; the API should show that rather than treating settlement as final.
Treat bulk uploads as individually addressable payouts with per-row errors, so operators can retry failures without resending successes.
Integrating acquirers and PSPs
In practice, "integration" means a server-to-server connection from your connector to the provider, plus a certification cycle that can take weeks. Some providers expose REST or SOAP APIs; older cores still speak ISO 8583 or proprietary formats. Your canonical model should hide that from merchants.
Build these patterns in from day one:
- Smart routing and failover. If one acquirer is down or declining a BIN range unusually often, route around it and log the reason so you can tune the rules.
- Timeouts and compensating actions. You must know whether a timed-out request was processed. That usually means a follow-up query API, not a blind retry.
- Per-merchant configuration. Soft descriptors, MCC, and 3DS settings are often contractual as well as technical, and they affect approval rates.
- Certificate and key management. Rotate credentials without a full deploy, and never share production keys across environments.
The gateway can orchestrate these relationships. It cannot replace them. The business still needs an acquiring contract and, in most jurisdictions, the relevant regulatory permissions before going live.
Tokenisation
Tokenisation replaces a PAN with a surrogate value that is useless if stolen on its own. PCI SSC's tokenisation guidelines are explicit about two points teams still get wrong: tokenisation does not remove the obligation to validate PCI DSS compliance, and you must be able to show that PAN cannot be recovered from any system you have taken out of scope.
Separate two kinds of tokens:
- Acquirer or gateway tokens. Created after the card is presented, stored for recurring or merchant-initiated charges, and typically detokenised only inside the vault or at the processor.
- Network / payment tokens, such as those specified in EMVCo's payment tokenisation work. These are issued in the scheme domain and can improve authorisation rates, but they are a different product with their own enrolment and lifecycle.
Audit-friendly rules: never store SAD after authorisation; restrict detokenisation to a tiny, monitored service; use tokens that cannot be reversed from the token alone; and keep test and production vaults separate. If a dashboard can export PAN, that dashboard is still in scope.
Reducing PCI DSS scope
The current standard is published by the PCI Security Standards Council. Scope is determined by where cardholder data is stored, processed, or transmitted, and by any system that can affect the security of that environment.
Architecture is one of the few levers that actually shrinks that footprint:
- Keep PAN out of the merchant application with hosted fields, iframes, or redirects.
- Keep PAN out of your own application tier where possible, by posting card data directly to a vault or processor and passing only a token onward.
- Segment the cardholder data environment. The vault, key store, and detokenisation path should sit on isolated networks with tightly controlled admin access.
- Minimise storage. Logs, support tools, and analytics are frequent leak points. If a log can print a PAN, that store is in scope.
- Do not assume a SAQ or "Level" from a vendor slide. Your assessor path depends on actual data flows, not on the software brand you licence.
White-label software can support a reduced-scope deployment, but the operator is still responsible for hosting, administration, and whether production matches the diagram in the report.
Build versus white-label
Whether to build this stack yourself or start from a white-label codebase depends on time, control, and what you are actually in the business of doing.
Build in-house if payments are your product, you already have people who have shipped connector certifications and PCI programmes, and you need unusual workflow control that a packaged platform cannot express. Budget for more than code: scheme certifications, 3DS, reconciliation, and a multi-year compliance calendar.
Choose a white-label or licensed platform if your differentiation sits above the rails — merchant experience, pricing, vertical features, or distribution — and you need a proven orchestration layer and a path to PCI-ready hosting. You still own operations, vendor due diligence, and acquiring relationships. Insist on clear licence terms, who is in scope as a service provider, and how you will exit if the vendor changes.
A hybrid is common: licence the core gateway, and build the product surface yourself. That only works if the APIs are complete enough that you are not waiting on the vendor for every new rail.
If you are weighing the business side as well as the technical one — licensing, acquiring relationships, and go-to-market — this guide to starting a payment gateway business covers those operational steps in more detail.
Whatever path you pick, treat these as non-negotiable: idempotent APIs, a real ledger, isolated tokenisation, explicit payout states, and a PCI scope diagram that matches production. Teams usually struggle less from missing features than from a blurry boundary between software, money movement, and compliance.
Ankit Kumar, ITIO Innovex
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.