compliance · 2025-03-03 · 8 min read

PCI DSS for front-end developers: the rules that touch your checkout form

You do not need to read 300 pages to avoid the biggest mistakes. These are the requirements that affect how you build, host and script a payment page.

The standard every merchant and processor must follow.
The standard every merchant and processor must follow. — © RDNE Stock project · Pexels

PCI DSS (Payment Card Industry Data Security Standard) is the rulebook every merchant and processor must follow, maintained by the PCI Security Standards Council. Version 4.0 became mandatory in 2024 and added requirements aimed squarely at the browser. For a front-end developer the practical takeaways fit on one page.

Scope: why you want SAQ A

If card data is entered into the provider's iframe or hosted fields and never touches your origin, you can usually self-assess under SAQ A — the shortest questionnaire. The moment your JavaScript reads the PAN, you fall into SAQ A-EP or SAQ D with dozens of additional controls. Architecture is your biggest compliance lever; tokenization explains the pattern.

The non-negotiables

  • Never log, store or send the PAN or CVV anywhere except the provider's tokenization endpoint.
  • Mask the PAN wherever it is displayed: first six / last four at most — see masking rules.
  • Serve the checkout only over TLS 1.2+ and set HSTS.
  • Keep third-party scripts, tag managers and chat widgets off the payment page (Requirement 6.4.3 now requires an inventory and integrity control for every script).
  • Monitor the payment page for unauthorized changes (Requirement 11.6.1) — skimming attacks like Magecart inject code client-side.
  • Do not pre-fill or 'remember' the security code, ever.

What about educational tools like this one?

This site never transmits what you type and tells you loudly not to enter a real card. That is the right posture for any demo, lab or validator: make clear it is not a payment form.

The Council's v4.0 quick reference is the readable summary; the full standard is for your QSA.

Hosted fields keep card data off your origin.
Hosted fields keep card data off your origin.

Keywords: PCI DSS, PCI compliance, SAQ A, hosted fields, cardholder data, PCI DSS 4.0, payment page security, requirement 6.4.3

Frequently asked questions

Do I need PCI compliance if I use Stripe or PayPal?

Yes, but using their hosted fields or iframes typically reduces you to SAQ A, the simplest self-assessment.

Can I store the last four digits of a card?

Yes. The last four (and first six) are not considered sensitive on their own and may be stored and displayed for identification.

On this site

External references

Related articles

PCI DSS لمطوّري الواجهات الأمامية: القواعد التي تمسّ نموذج الدفع — النسخة العربية

لست بحاجة لقراءة 300 صفحة لتجنّب الأخطاء الكبرى. هذه المتطلبات التي تؤثر في كيفية بناء صفحة الدفع واستضافتها وبرمجتها.

PCI DSS (معيار أمن بيانات صناعة بطاقات الدفع) هو كتاب القواعد الذي يجب أن يلتزم به كل تاجر ومعالج، ويديره مجلس معايير أمن PCI. أصبح الإصدار 4.0 إلزاميًا في 2024 وأضاف متطلبات موجّهة مباشرة إلى المتصفح. وبالنسبة لمطوّر الواجهة الأمامية فالخلاصات العملية تتسع في صفحة واحدة.

النطاق: لماذا تريد SAQ A

إذا أُدخلت بيانات البطاقة في إطار iframe أو الحقول المستضافة للمزوّد ولم تلمس نطاقك إطلاقًا، فيمكنك عادة التقييم الذاتي وفق SAQ A — أقصر الاستبيانات. وفي اللحظة التي يقرأ فيها JavaScript لديك رقم البطاقة تقع في SAQ A-EP أو SAQ D مع عشرات الضوابط الإضافية. البنية هي أكبر رافعة امتثال لديك؛ الترميز يشرح النمط.

ما لا يُتفاوض عليه

  • لا تسجّل رقم البطاقة أو CVV ولا تخزّنهما ولا ترسلهما لأي مكان سوى نقطة الترميز لدى المزوّد.
  • أخفِ رقم البطاقة أينما عُرض: أول ست / آخر أربع على الأكثر — انظر قواعد الإخفاء.
  • قدّم صفحة الدفع عبر TLS 1.2+ فقط واضبط HSTS.
  • أبعد السكربتات الخارجية ومديري الوسوم وأدوات الدردشة عن صفحة الدفع (المتطلب 6.4.3 يفرض الآن جردًا وضبط سلامة لكل سكربت).
  • راقب صفحة الدفع بحثًا عن تغييرات غير مصرّح بها (المتطلب 11.6.1) — هجمات السرقة مثل Magecart تحقن كودًا في جهة العميل.
  • لا تملأ رمز الأمان مسبقًا ولا «تتذكّره» أبدًا.

ماذا عن الأدوات التعليمية مثل هذه؟

هذا الموقع لا يرسل ما تكتبه أبدًا ويخبرك بصوت عالٍ ألا تُدخل بطاقة حقيقية. هذا هو الموقف الصحيح لأي عرض أو مختبر أو مدقّق: وضّح أنه ليس نموذج دفع.

المرجع السريع للإصدار 4.0 من المجلس هو الملخص المقروء؛ والمعيار الكامل لمقيّمك المعتمد.

أسئلة شائعة

هل أحتاج امتثال PCI إن كنت أستخدم Stripe أو PayPal؟

نعم، لكن استخدام حقولهم المستضافة أو إطاراتهم يختزلك عادة إلى SAQ A، أبسط تقييم ذاتي.

هل يمكنني تخزين آخر أربع خانات من البطاقة؟

نعم. آخر أربع (وأول ست) لا تُعدّ حساسة بذاتها ويجوز تخزينها وعرضها للتعريف.

Educational content — not legal or financial advice. Open the interactive Check Digit Lab →