Technology

PCI‑DSS Compliant E‑Commerce Hosting Architecture: Keeping Card Data Off Your Servers

When we review e‑commerce projects with customers, one theme comes up again and again: they want to accept online card payments without turning their entire hosting stack into a full PCI‑DSS battlefield. The most effective strategy is simple in theory but requires disciplined implementation: keep cardholder data off your servers completely. If card numbers never touch your application servers, databases, logs or backups, your PCI scope, risk and maintenance burden drop dramatically.

In this article we will walk through how to design a PCI‑DSS friendly e‑commerce hosting architecture where your website, API and databases stay firmly out of the card data flow. We will look at practical patterns using hosted payment pages, tokenization, JavaScript SDKs and strict logging/backup practices. We will also map these patterns to SAQ types (especially SAQ A vs SAQ A‑EP), and highlight the hosting‑side controls you still must implement: TLS, WAF, hardening, monitoring and encrypted backups. Our goal as dchost.com is to give you a realistic blueprint you can deploy today, whether you are running WooCommerce, Magento, PrestaShop or a custom stack.

Why Keeping Card Data Off Your Servers Matters

PCI‑DSS is not just about passing an annual checklist. It exists because cardholder data (PAN, expiry, CVV) is extremely valuable to attackers and very expensive to handle incorrectly. The more places card data can appear in your infrastructure, the larger your attack surface and the more controls you are required to implement and document.

Architecturally, you have two broad options:

  • Card‑present architecture on your servers: your app directly accepts, processes or stores card data. This usually leads to SAQ D scope, the heaviest possible burden.
  • Card‑absent architecture on your servers: card data is entered and transmitted only through PCI‑certified third‑party payment pages, iframes or SDKs. Your systems see only tokens and statuses. This can often qualify you for SAQ A or sometimes SAQ A‑EP, with far fewer technical requirements.

By ensuring that cardholder data never flows through your hosting environment, you reduce:

  • The number of systems in PCI scope
  • The depth of required network segmentation and logging controls
  • The risk of accidentally storing card data in logs, backups or database fields
  • The cost of audits, penetration tests and remediation work

From a hosting perspective, this approach lets you focus on protecting customer accounts, orders and personal data, instead of trying to build a miniature card processing environment in your web cluster.

Understanding PCI‑DSS Scope: SAQ A vs SAQ A‑EP vs SAQ D

Before designing your architecture, you need to understand which Self‑Assessment Questionnaire (SAQ) you are aiming for. Your hosting decisions directly influence this.

SAQ A: The Gold Standard for “No Card Data Here”

SAQ A is designed for merchants who have fully outsourced card data handling to PCI‑validated third parties. To qualify, your environment must meet conditions such as:

  • All cardholder data functions (payment pages, iframes, SDKs) are hosted by a PCI‑compliant provider.
  • Your server never receives card numbers, expiry or CVV in requests, responses, logs, emails or backups.
  • Your website is not handling the actual payment form fields; it only redirects customers or embeds hosted payment components.

In SAQ A, your web hosting environment is still in scope for some controls (like secure redirects, protection from tampering and strong TLS), but it is not a cardholder data environment. That is exactly where a well‑designed architecture can get you.

SAQ A‑EP: When Your Site Still Influences the Payment Page

SAQ A‑EP applies when:

  • Your website does not receive card data directly, but it serves pages that influence the content or delivery of payment pages or scripts.
  • For example, you host the checkout page and load a payment JavaScript from the PSP that then renders card fields on your domain.

In SAQ A‑EP, your application and hosting environment are more tightly in scope, because if attackers compromise your checkout page or injected scripts, they might be able to skim card data before it reaches the provider. Requirements for secure development, WAF, logging and change control become stricter than SAQ A.

SAQ D: Full Responsibility

If your server ever:

  • Receives raw card details in POST data or AJAX requests
  • Stores PAN in the database, logs or backups
  • Processes card data before sending it to a PSP

…you are typically in SAQ D territory. Your entire hosting stack (web servers, databases, backup systems, monitoring, jump hosts) becomes part of the cardholder data environment (CDE). This significantly increases the number of PCI controls you must implement.

Our goal in this article is to keep you away from SAQ D whenever reasonably possible by rethinking your e‑commerce hosting architecture.

Architecture Patterns That Keep Card Data Off Your Servers

Let’s go through the main patterns we see working well in real e‑commerce deployments, and how they interact with your hosting stack.

Pattern 1: Full Redirect to Hosted Payment Page (Classic SAQ A)

This is the simplest and most robust option.

  1. Customer checks out on your site and confirms order details.
  2. Your app generates an order record and a “pending payment” status.
  3. You redirect the customer (302 or POST redirect) to a hosted payment page at your payment service provider (PSP).
  4. The entire card entry form is loaded from the PSP’s domain, under their TLS certificate.
  5. After payment, the PSP redirects back to your site with a token or payment status (success/failure, last 4 digits, brand, but never PAN).

From a hosting perspective:

  • Your web server never sees card numbers or CVV.
  • Web, database and backup systems handle only order IDs, customer info and non‑sensitive payment metadata.
  • You still must ensure secure redirects, strong TLS and protection against tampering, but PCI scope is smaller.

Most PSPs support this model out of the box. The key is to never log the raw redirect query strings if they might contain sensitive data (for example, some older integrations send masked PAN or authorization codes – treat these carefully).

Pattern 2: Embedded Hosted Iframe for Card Entry

Here, the checkout page is on your domain, but the actual card form sits inside an iframe served by the PSP.

  • Your HTML layout, cart summary and address fields are rendered by your application.
  • The card number and CVV fields are hosted within an iframe from the PSP’s domain.
  • Keystrokes and card data flow directly from the customer’s browser to the PSP, bypassing your servers.

Security and hosting implications:

  • Your servers still do not receive card data, but your page is now closely tied to the payment component.
  • Depending on exact integration, you may fall into SAQ A‑EP rather than SAQ A, because a compromise of your checkout page could change iframe parameters or overlay a fake form.
  • You must be stricter with WAF rules, change management and integrity monitoring of the checkout templates.

This pattern is often used by WooCommerce and Magento sites that want a more integrated UX. It can be secure, but your hosting environment now has more PCI expectations placed on it.

Pattern 3: JavaScript Payment Fields / Tokenization

Modern PSPs offer client‑side JavaScript libraries that:

  • Render card fields or intercept card input on your checkout page
  • Send the card data directly to the PSP’s servers
  • Return a token to your JavaScript code (e.g. payment_method_id or token_id)
  • Your backend receives only the token, never the card data

This model powers one‑click payments, saved cards and recurring billing. Architecturally:

  • Your application backend receives the token and associates it with an order or customer record.
  • The PSP stores the actual card, and future charges use the token only.
  • Your logs and databases must be checked to ensure no debugging traces ever log raw card fields (e.g. avoid dumping the entire request body before tokenization).

This approach often falls under SAQ A‑EP if the script runs on your domain, because compromised JavaScript can skim cards. That means your hosting stack must implement good HTTP security headers, subresource integrity (where supported) and tight deployment controls. Our guide on HTTP security headers for shared hosting and VPS is a practical companion for hardening this setup.

Pattern 4: Mobile Apps with PSP SDKs

If you have mobile apps, you can integrate PSP‑provided SDKs that handle card entry and tokenization directly on the device. Your backend then receives a token just like in the browser case.

Hosting implications:

  • Your API endpoints should accept only tokens, not raw card details.
  • Validate payloads and log structures to ensure no card data is accidentally passed through.
  • Apply strong TLS and authentication between app and API server.

The same principles apply: your hosting environment must be carefully designed to avoid ever handling cardholder data.

Designing Your Hosting Stack for a Card‑Free CDE

Assuming you choose an architecture where card data is handled only by a PCI‑validated PSP, how should you design your hosting stack at dchost.com to support that safely?

1. Strictly Separate “Payment Logic” from “Payment Data”

Your code will still contain business logic such as:

  • Creating orders and calculating totals
  • Choosing payment methods and routing to PSP
  • Handling webhooks / callbacks for payment status

But it must never handle raw payment data. In practice:

  • Define clear DTOs (data transfer objects) or request schemas that include only tokens and non‑sensitive metadata.
  • In frameworks like Laravel or Symfony, restrict request validation rules so they reject any unexpected fields like card_number or cvv.
  • Search your codebase for any usage of card‑related field names and ensure they exist only in PSP integration libraries, not in your own controllers or models.

This logical separation may sound like development work, but it has architectural consequences: your databases and backups will never contain the most sensitive data class PCI cares about.

2. TLS, Certificates and Protocols: Getting HTTPS Right

Even if you do not handle card data, HTTPS is mandatory for login, checkout and any pages that redirect or embed payment content. PCI‑DSS expects strong encryption, modern protocols and regular maintenance.

  • Use TLS 1.2+ and preferably TLS 1.3 with modern cipher suites.
  • Disable insecure protocols and legacy ciphers.
  • Automate certificate renewal to avoid expiry incidents.
  • Choose the right certificate type (DV, OV, EV, SAN, wildcard) based on your domain strategy.

If you are unsure which certificate fits your store, our article on DV vs OV vs EV SSL certificates for corporate and e‑commerce sites goes into detail, and Let’s Encrypt vs paid SSL certificates explains when free automation is enough and when a commercial certificate is more appropriate.

On our side, we help customers configure web servers (Nginx, Apache or LiteSpeed) according to the latest SSL/TLS protocol updates, closing outdated versions and aligning with PCI’s evolving expectations.

3. WAF, Bot Protection and Hardening for Checkout Pages

Even if card data does not flow through your servers, attackers may try to:

  • Inject malicious JavaScript into your checkout page to skim cards before tokenization.
  • Exploit plugin or theme vulnerabilities to alter PSP integration parameters.
  • Launch credential stuffing or brute‑force attacks on customer accounts, which indirectly affects payment fraud risk.

We strongly recommend placing a Web Application Firewall (WAF) in front of your e‑commerce site, either at the origin (e.g. ModSecurity) or at the edge. Our guide on what a WAF is and how to use Cloudflare WAF and ModSecurity explains how to tune rules to catch real threats while minimizing false positives.

Beyond WAF:

  • Harden your CMS or framework (WordPress, Magento, custom PHP) with least‑privilege file permissions and security plugins where appropriate.
  • Restrict admin panel access by IP, VPN or zero‑trust tools (we described such patterns in our article on zero‑trust access to hosting panels and servers).
  • Keep themes, plugins and dependencies patched; integrate patching into your deployment pipeline.

4. Database and Cache Design: No PAN Columns, Ever

One of the easiest ways to accidentally fall into SAQ D is to “temporarily” store card numbers for debugging or convenience. Architecturally, you should treat this as forbidden:

  • Do not create columns like card_number, expiry_month, cvv anywhere in your schema.
  • If you need to display card brand and last 4 digits, store those only (e.g. card_last4, card_brand), sourced from the PSP’s response.
  • For recurring billing, store PSP tokens and customer IDs, not raw card data.
  • Ensure that caches (Redis, Memcached, object caches) never hold raw card fields – design your payload structures accordingly.

If you already have a database that once stored card details, you will need a careful cleanup and data destruction process; we will cover migration later in this article.

Logs, Backups and Monitoring Without Card Data

Keen PCI‑DSS assessors often uncover issues not in the main application, but in logs and backups where card data has leaked accidentally. When designing hosting architecture at dchost.com, we pay close attention to these “secondary” systems.

1. Web and Application Logs

Common pitfalls:

  • Access logs that include full query strings or POST bodies containing card data.
  • Debug logs that dump entire request/response structures, including payment fields.
  • Application error handling that serializes sensitive objects into log files or error monitoring tools.

Mitigations:

  • Configure web servers to exclude sensitive URLs from detailed logging, or to scrub specific parameters.
  • At the application layer, never log full request bodies on checkout or payment routes.
  • Mask or redact any field names that could theoretically contain card or CVV data.

If you run centralized logging or SIEM tools, consider IP anonymization and masking for privacy regulations. Our article on log anonymization and IP masking techniques for GDPR‑compliant hosting fits well with PCI’s expectations around minimizing sensitive data in logs.

2. Database and File Backups

Even if your live database is clean, backups can trap old sins for years. Your backup architecture should assume that:

  • Any card data that ever touches your DB or file system could live in backups for the full retention period.
  • PCI requires strong encryption, key management and controlled access for any medium that might contain cardholder data.

So your design should:

  • Ensure the application does not write card data to the database or file system in the first place.
  • Encrypt all database and file backups, including off‑site copies and object storage.
  • Implement strict access controls for backup repositories and keys.
  • Define retention periods in line with business and regulatory needs, and delete backups when no longer required.

We covered these topics in detail in our guide on backup encryption and key management for GDPR‑safe hosting; the same practices align well with PCI‑DSS expectations.

3. Monitoring, APM and Error Tracking Tools

Third‑party monitoring or APM agents can sometimes collect HTTP payloads, headers or environment variables. To keep them PCI‑friendly:

  • Disable full request body capture on payment endpoints.
  • Mask field names that might contain sensitive data (even if you believe your app never sends it).
  • Scope access to monitoring dashboards and logs based on least privilege.

When we help customers integrate monitoring stacks like Prometheus, Grafana and application error trackers, we pay attention to which metrics and logs are exported to ensure no sensitive payment data ever leaves the primary environment.

Migrating an Existing Store to a Card‑Free Architecture

Many merchants come to us with an existing e‑commerce site that was not originally designed with PCI in mind. Migrating to a card‑free architecture is absolutely possible, but it must be planned carefully.

Step 1: Map Current Data Flows

Work with your development team to document:

  • How payments are currently handled (redirect, iframe, direct POST, JS SDK).
  • Which endpoints receive card details.
  • Where those details might be logged (web logs, app logs, error trackers).
  • Which database tables or storage locations might contain PAN, expiry or CVV.

This step often reveals surprising legacy code paths or debug features that were forgotten.

Step 2: Switch to Token‑Based PSP Integrations

Next, design a new integration with your PSP that follows one of the safer patterns:

  • Hosted payment page redirects (ideal for simpler SAQ A setups).
  • Hosted iframes or JS tokenization libraries (more control, typically SAQ A‑EP).

Update your checkout UX to use tokens only, and ensure your backend APIs and database schema are updated to work with tokens instead of raw card fields.

Step 3: Eradicate Existing Card Data

Once the new flow is live and tested, plan a cleanup:

  • Identify all database columns that ever stored PAN, expiry or CVV. Migrate or delete this data according to your PSP and legal team’s plan.
  • Review file storage (old CSV exports, logs, error dumps, attachments) for card details.
  • Implement secure deletion or overwrite strategies where appropriate.

Note: cleanup does not retroactively fix old backups. You must treat any existing backups that might contain card data as sensitive until they expire or are securely destroyed.

Step 4: Adjust Backups, Logs and Monitoring Configs

With the new architecture, update your logging and backup configurations:

  • Disable or aggressively scrub logs on payment endpoints.
  • Ensure backup encryption and access controls match your new risk profile.
  • Test restores and log retrieval to confirm no card data appears after the migration date.

At dchost.com we often combine this migration with a hosting refresh: moving to a tuned VPS or dedicated server, setting up WAF rules and implementing monitored backups. Our earlier article on PCI‑DSS compliant e‑commerce hosting covers the baseline server, SSL, log and backup controls we recommend.

How dchost.com Fits into a PCI‑Friendly E‑Commerce Stack

As your hosting provider, we are not your PCI auditor or your PSP – but we are responsible for the infrastructure where your site or application lives. In a card‑free architecture, our job is to keep that environment secure, observable and predictable, while ensuring it never accidentally becomes part of the cardholder data environment.

Typical setups we see for PCI‑aware e‑commerce customers include:

  • Isolated VPS for the application, with Nginx/Apache/LiteSpeed, PHP‑FPM and a tuned database (MariaDB/MySQL or PostgreSQL) sized based on real traffic and catalog size.
  • Staging environments to test PSP integrations, TLS changes and WAF rules before going live.
  • Automated TLS management with Let’s Encrypt or commercial certificates, aligned with our TLS best practices.
  • Off‑site encrypted backups for both files and databases, with retention policies matched to your compliance and business needs.
  • Perimeter protections such as basic DDoS mitigation, WAF and rate limiting, plus OS‑level hardening on VPS and dedicated servers.

For stores based on WooCommerce, Magento or PrestaShop, we combine this with performance tuning and caching so you are not forced to choose between security and speed. Our dedicated WooCommerce and Magento hosting guides, as well as our article on PCI‑DSS compliant hosting, give concrete sizing and tuning examples.

Bringing It All Together: Card‑Free, PCI‑Aware Hosting

Designing a PCI‑DSS compliant e‑commerce hosting architecture does not have to mean turning every server into a full cardholder data environment. By deliberately keeping card data off your servers and letting a PCI‑validated payment provider handle the sensitive parts, you can often aim for SAQ A or SAQ A‑EP instead of SAQ D, drastically reducing complexity and risk.

The key architectural principles are clear:

  • Use hosted payment pages, iframes or tokenization SDKs so your servers see only tokens and statuses, never raw PAN or CVV.
  • Ensure your application code, schemas and APIs are designed around tokens, with no card‑related columns or debug logs.
  • Harden your hosting environment with modern TLS, WAF, secure headers, least privilege and regular patching so attackers cannot tamper with checkout flows.
  • Treat logs, backups and monitoring as first‑class citizens in your design, ensuring they never become a hidden repository of card data.

At dchost.com we help customers put these ideas into production: from choosing the right VPS or dedicated server to configuring TLS, WAF, backups and monitoring in a way that supports your PCI journey rather than fighting it. If you are planning a new store or refactoring an existing one, we recommend reading our more detailed PCI‑DSS for e‑commerce hosting playbook alongside this article, then talking with your payment provider and our team to design a concrete architecture and migration plan that fits your real traffic, tech stack and compliance goals.

Frequently Asked Questions

Yes. Keeping card data off your servers dramatically reduces scope and risk, but PCI‑DSS still expects you to protect the parts of the system that influence payments. If your site redirects to a hosted payment page (SAQ A), you must maintain secure HTTPS, prevent tampering with redirect URLs and keep your platform patched. If you embed iframes or payment JavaScript (often SAQ A‑EP), you also need solid WAF rules, HTTP security headers, change control and integrity monitoring on checkout pages. The good news is that these controls are much lighter than running a full cardholder data environment, and they overlap strongly with what you should already be doing for general web security and GDPR/KVKK compliance.

From a PCI‑scoping perspective, full redirect to a hosted payment page is typically the cleanest option and most likely to qualify for SAQ A. Your checkout page sends the customer to a PSP URL, where card data is entered entirely under the provider’s control, and your server only gets tokens or status codes in return. Hosted iframes and JavaScript tokenization can be equally safe technically, but often push you into SAQ A‑EP because your checkout page and scripts directly influence the payment component. That means more hosting‑side controls and documentation. In practice, many merchants choose redirect for simplicity, or JS tokenization when they need tighter UX integration or features like saved cards and subscriptions.

Start by designing your application so raw card data never reaches your backend at all—use hosted payment pages, iframes or tokenization SDKs so only tokens and statuses are processed. Then audit your logging and backup configurations. On the server side, scrub or disable detailed logging for payment endpoints, avoid logging request bodies and mask any fields that might conceivably contain PAN or CVV. In your application, remove debug statements that dump entire request objects. For backups, encrypt database and file backups, control access to backup storage and set realistic retention periods. Finally, spot‑check restored backups and log exports to confirm they contain only non‑sensitive payment metadata (e.g. last 4 digits, brand, tokens), never full card numbers.

Yes. Modern payment service providers support tokenization, where they store the card, and your systems store only a token that represents it. The typical flow is: the customer enters card details on a hosted page, iframe or JS field; the PSP validates the card and returns a reusable token; your application saves this token along with non‑sensitive metadata (brand, last 4, expiry month/year) to display to the user. For subscriptions or one‑click payments, your backend sends the token to the PSP’s API to charge the card. At no point does your database or file system contain PAN or CVV, so you retain the UX benefits of stored cards while keeping your hosting environment outside the cardholder data environment.

You can, but you need a careful migration plan. First, implement a new integration with your PSP that uses hosted pages, iframes or tokenization so future payments never send raw card data to your backend. Then, map all places where card data was stored: database tables, exports, logs and file storage. Work with your PSP and legal team to determine whether any of that data needs to be migrated or can be securely deleted. Clean up schemas by removing card‑related columns and refactoring code to use tokens only. Finally, treat historical backups that may contain PAN as sensitive until they age out or are securely destroyed. Over time, this lets you move toward a reduced‑scope PCI posture, even if you previously operated as a cardholder data environment.