Implement PCI DSS compliance requirements for secure handling of payment card data and payment systems. Use when securing payment processing, achieving PCI compliance, or implementing payment card security measures.
No setup needed. Let our cloud agents run this skill for you.
Select Provider
Select Model
Claude Sonnet 4.5
$0.20/task
Best for coding tasks
No setup required
PCI Compliance
Master PCI DSS (Payment Card Industry Data Security Standard) compliance for secure payment processing and handling of cardholder data.
When to Use This Skill
Building payment processing systems
Handling credit card information
Implementing secure payment flows
Conducting PCI compliance audits
Reducing PCI compliance scope
Implementing tokenization and encryption
Preparing for PCI DSS assessments
PCI DSS Requirements (12 Core Requirements)
Build and Maintain Secure Network
Install and maintain firewall configuration
Don't use vendor-supplied defaults for passwords
Protect Cardholder Data
Protect stored cardholder data
Encrypt transmission of cardholder data across public networks
Maintain Vulnerability Management
Protect systems against malware
Develop and maintain secure systems and applications
Implement Strong Access Control
Restrict access to cardholder data by business need-to-know
Identify and authenticate access to system components
Restrict physical access to cardholder data
Monitor and Test Networks
Track and monitor all access to network resources and cardholder data
Regularly test security systems and processes
Maintain Information Security Policy
Maintain a policy that addresses information security
Compliance Levels
Level 1: > 6 million transactions/year (annual ROC required)
Level 2: 1-6 million transactions/year (annual SAQ)
Level 3: 20,000-1 million e-commerce transactions/year
Level 4: < 20,000 e-commerce or < 1 million total transactions
Data Minimization (Never Store)
# NEVER STORE THESEPROHIBITED_DATA = { 'full_track_data': 'Magnetic stripe data', 'cvv': 'Card verification code/value', 'pin': 'PIN or PIN block'}# CAN STORE (if encrypted)ALLOWED_DATA
Tokenization
Using Payment Processor Tokens
import stripeclass TokenizedPayment: """Handle payments using tokens (no card data on server).""" @staticmethod def create_payment_method_token(card_details):
Custom Tokenization (Advanced)
import secretsfrom cryptography.fernet import Fernetclass TokenVault: """Secure token vault for card data (if you must store it).""" def __init__(self, encryption_key): self.cipher = Fernet(encryption_key) self.vault =
Encryption
Data at Rest
from cryptography.hazmat.primitives.ciphers.aead import AESGCMimport osclass EncryptedStorage: """Encrypt data at rest using AES-256-GCM.""" def __init__(self, encryption_key): """Initialize with 256-bit key.""" self.key = encryption_key # Must be 32 bytes
import redef validate_card_number(card_number): """Validate card number format (Luhn algorithm).""" # Remove spaces and dashes card_number = re.sub(r'[\s-]', '', card_number) # Check if all digits if not card_number.isdigit(): return
PCI DSS SAQ (Self-Assessment Questionnaire)
SAQ A (Least Requirements)
E-commerce using hosted payment page
No card data on your systems
~20 questions
SAQ A-EP
E-commerce with embedded payment form
Uses JavaScript to handle card data
~180 questions
SAQ D (Most Requirements)
Store, process, or transmit card data
Full PCI DSS requirements
~300 questions
Compliance Checklist
PCI_COMPLIANCE_CHECKLIST = { 'network_security': [ 'Firewall configured and maintained', 'No vendor default passwords', 'Network segmentation implemented' ], 'data_protection': [ 'No storage of CVV, track data, or PIN', 'PAN encrypted when stored', 'PAN masked when displayed'
Resources
references/data-minimization.md: Never store prohibited data