Security
PCI-DSS Compliance Basics for Developers Handling Payment Forms
If your website takes card payments, you will sooner or later meet the Payment Card Industry Data Security Standard, usually shortened to PCI DSS. It has a reputation for being long and intimidating, but the basic ideas are easy to grasp, and good design decisions can remove most of the burden. This guide gives developers a plain-language overview. It is general education, not legal or compliance advice.
What PCI DSS is
PCI DSS is a set of security requirements for any organization that stores, processes or transmits payment card data. It is created and maintained by the PCI Security Standards Council, which was formed by the major card networks, and it is enforced through the contracts between merchants and their banks rather than by a government. The current generation of the standard is version 4.0, with a later revision, 4.0.1, published in 2024. It is organized into twelve main requirements covering topics such as secure networks, protecting stored data, encryption in transit, vulnerability management, access control, monitoring and security policies.
What counts as cardholder data
The standard distinguishes two groups of data:
- Cardholder data: the primary account number (the card number), the cardholder name, the expiry date and the service code. These may be stored only if there is a business need, and the card number must be protected when stored.
- Sensitive authentication data: the full magnetic stripe or chip data, the card security code (CVV, CVC or similar) and the PIN. This data must never be stored after authorization, even if it is encrypted.
The security code deserves emphasis because it is the one many developers are tempted to keep for convenience. Do not. It exists to prove that someone has the physical card at the time of payment, and keeping it defeats that purpose.
Scope is your biggest lever
PCI requirements apply to every system that touches cardholder data, along with the systems connected to them. This is called your scope, and shrinking it is the single most effective way to reduce work and risk. The less card data passes through your servers, the less there is to protect, audit and lose.
- Hosted payment page or redirect. The customer is sent to your provider’s page to pay, so card data never touches your site. This gives the smallest scope.
- Hosted fields or embedded frames. Your page contains fields served from the provider’s domain, so card numbers go straight to the provider. Your page still matters for security, because a compromised script could interfere with the checkout.
- Direct post or fully custom handling. Card data passes through your own server. This brings the most requirements and the most risk, and it is rarely worth it for a small business.
The council publishes self-assessment questionnaires for different setups, and the lightest one applies to merchants that fully outsource card handling. Your payment provider or acquiring bank can tell you which applies to you.
Habits that keep you safe
- Never log card data. Check your application logs, error trackers, analytics tags and support tools to be sure that nothing captures form fields.
- Use HTTPS everywhere. Encrypt all traffic, redirect plain HTTP, and keep certificates current.
- Mask when displaying. If you must show a card number, show only the leading and trailing digits permitted by the standard, such as the last four.
- Use tokens. Store the provider’s token for a saved card and not the number itself.
- Limit access. Give people and services only the access they need, use unique accounts, and turn on multi-factor authentication.
- Keep software up to date. Patch frameworks, libraries and servers promptly.
- Review changes. Treat any change to a payment page as security-relevant.
Protecting the payment page itself
Version 4.0 pays particular attention to the scripts on a payment page, because attackers have targeted checkout pages by injecting malicious code through third-party scripts. Sensible measures include:
- keeping an inventory of every script on the payment page and a reason for each,
- loading only scripts you trust, and avoiding unnecessary tags on checkout pages,
- using a Content Security Policy, which tells the browser which sources may run code, and
- using Subresource Integrity so that a changed file is rejected.
You can learn how the policy header works in the MDN guide to Content Security Policy.
Where format validation fits
Checking a card number’s format in the browser, as described in our guide to client-side payment form validation, is compatible with these practices as long as the number stays in the customer’s browser and goes only to the payment provider. Validation is a convenience layer. It sits beneath stronger controls, as we explain in our article on fraud prevention and format validation. For our own tools, card numbers are checked in your browser and are never stored, and the FAQ describes how.
Common misunderstandings
- “We are too small for PCI.” The standard applies to every merchant that accepts cards, although the amount of work varies.
- “Our provider handles it, so we have no obligations.” Using a compliant provider greatly reduces your scope, but you still have responsibilities, such as securing your own site and completing the right questionnaire.
- “Encryption means we can store anything.” Encryption protects stored card numbers, but it does not make storing the security code acceptable.
- “Compliance is a one-time project.” It is an ongoing practice that must be repeated and reviewed.
Getting help
If you are unsure which requirements apply, ask your payment provider or acquiring bank, and consult the official documents library of the PCI Security Standards Council. Larger organizations often work with a qualified security assessor. Tvalidora is not a compliance advisor, so treat this article as an introduction.
Key takeaways
PCI DSS rewards simplicity. Touch as little card data as you can, never store the security code, keep card numbers out of your logs, and protect the page that collects the payment. Hosted fields or a hosted payment page remove most of the burden for small teams. Combine those design choices with solid everyday security habits, and you will have a much easier time with both customers and auditors. To see a privacy-first approach in action, try the Tvalidora validator.
Put it into practice: check the format of a card, routing or account number with the Tvalidora validator, look up an area code or zip code with the US Checker, or read the FAQ to see exactly what a “valid” result means. Tvalidora checks number format only, and never stores what you enter.