How to add a secure credit card form
to your website
The short answer: don't build the card fields yourself. Put a form on your site that is served by a PCI DSS compliant provider, so the card number goes from your customer's browser straight to that provider and never touches your server. That one decision is the difference between a short compliance questionnaire and the full standard. The longer answer is whose form — your payment processor's, or an independent one — and that depends on how you charge your customers.
The three ways to take cards on a website
1. Build your own form. Add card number, expiry and CVV fields to a form on your site and post them to your server, which passes them to your processor. It looks simple and it is the expensive option. The moment card numbers arrive at your web server, that server, its hosting, its logs, its backups and everything networked to it are in PCI scope, and you validate against SAQ D: the full standard, more than 250 requirements. A plugin that collects raw card fields on your own pages lands you in the same place.
2. Use your processor's hosted form or fields. Almost every processor offers a payment page you redirect to, or card fields that load inside your checkout from the processor's domain. The card goes to the processor, your systems get back a token or a payment result, and you can usually validate with SAQ A. For a business that takes payment at checkout through one processor, this is often the right answer, and we'd tell you so.
3. Embed an independent card vault's form. A vault that is not your processor serves the form, stores the card, and gives you a token. You charge that token through the processor you already use — now or later. The PCI picture is the same as option 2 (the card never touches you), but the card on file belongs to a vault you control rather than to your processor.
What each option does to your PCI scope
PCI DSS applies to every system that stores, processes or transmits card data, plus anything connected to it (the plain-English scope guide walks through this). A form you build yourself pulls your website into scope. A hosted or embedded form from a compliant provider keeps it out, because the card number travels from the customer's browser to the provider without passing through your server.
One 2025 change to know about. In January 2025 the PCI Security Standards Council revised SAQ A. Two technical requirements about payment-page scripts were removed from the questionnaire and replaced by an eligibility condition: to use SAQ A, you confirm that your site is not susceptible to attacks from scripts that could affect your e-commerce systems. In practice that means:
- Your provider should be able to assure you that its embedded frame is protected when it is installed as documented. The Council's guidance allows you to rely on that assurance.
- Your own pages still need basic hygiene: HTTPS everywhere, scripts loaded only from sources you trust, and no third-party script you can't account for on the page that hosts the card form.
- Your acquirer or processor decides which questionnaire you complete. Ask them if you are unsure.
When your processor's form is the right choice
If you take payment once, at checkout, through a single processor, and you have no plans to change processor, your processor's hosted page or fields are the simplest compliant option. One account, one form, one integration. If you don't have a processor yet, an all-in-one provider that gives you both the merchant account and the form is the fastest way to start taking cards.
When an independent card form is the better choice
The processor's form stops being the obvious answer when the card has to outlive the checkout:
You keep cards on file. Deposits, no-show fees, balances charged after the service, subscriptions, repeat orders. The card you captured on your website is charged weeks or months later, often by your staff rather than at a checkout. That is a vaulting problem first and a payment problem second (see recurring billing without storing cards).
You might change processor. Cards saved inside a processor's vault are tokens that only that processor can charge. Changing processor usually means asking every customer for their card again, or negotiating a data migration between providers. Cards in an independent vault stay where they are when the processor changes.
You use more than one processor. Different locations, currencies or business lines on different merchant accounts — one form and one card on file can serve all of them.
Your processor's form doesn't fit. Some processors, especially bank-provided merchant services, offer only a redirect page or a basic form. An embedded form keeps the customer on your site.
How an embedded vault form works
You add a short script to your page and a placeholder where the card form should appear. The script loads the card fields inside a frame served from the vault's own domain. The customer types their card there; it goes straight to the vault, which encrypts and stores it and returns a token to your page. Your systems keep only the token and the last four digits. When it is time to charge, you or your staff charge the token, and the vault sends the payment to your processor.
You can see one running: the developer page has a live card form embedded in it (a preview that stores and charges nothing), and the integration docs show the code. If you don't have a website checkout at all, the same capture works as a secure link you send by email or text (see what replaced the authorization form).
What to ask any provider before you embed its form
- Its PCI DSS Attestation of Compliance as a service provider, current and covering the service you'll use.
- Which processors it can charge through, by name, today — not "most major processors". Check yours is on the list before you build.
- How its frame is protected against script attacks when installed as documented, for your SAQ A eligibility.
- Whether you can take your cards with you if you leave.
- What the form looks like on your site: whether it matches your design, and whether it works on phones.
Frequently asked questions
Can I just add credit card fields to my own website form?
You can, but it puts your web server and everything connected to it in PCI scope, and you validate against SAQ D, the full standard. A hosted or embedded form from a compliant provider keeps card numbers off your systems.
Is an iframe card form secure?
Yes, when a PCI DSS compliant provider serves it: the card goes from the customer's browser to the provider, and your page's scripts can't read it. Since 2025 you also confirm your site isn't open to script attacks; you can rely on your provider's assurance for the frame itself.
Do I need my processor's form to take cards on my website?
No. It's the simplest option. An independent vault's form captures and stores the card, and you charge it through the processor you already use — useful when you keep cards on file, run more than one processor, or may switch.
Which SAQ do I fill in if I embed a hosted card form?
Usually SAQ A for card-not-present merchants who fully outsource capture to a compliant provider and meet its eligibility criteria. Your acquirer or processor has the final say.
What should I ask a provider before I embed its form?
Its service-provider Attestation of Compliance, which processors it charges through, how its frame is protected against script attacks, and whether you can take your cards with you if you leave.
A card form that isn't tied to your processor
Card Vault serves the card form on your website, stores the card in a PCI DSS v4.0.1 compliant vault, and gives you a token to charge through your processor — at checkout, later, or on a schedule. Our service-provider Attestation of Compliance is available on request. Start free with five cards.