Key takeaways
- A payment iframe only protects you if the card is typed directly into it; never capture the number in your own fields first.
- Load the provider's script from the provider; hosting or proxying it can put your servers back in scope.
- The checkout page around the iframe is still yours, so vet every third-party script that runs on it.
- Make sure no logs or error handlers record the contents of payment fields.
- The iframe removes card data but not your other duties: access control, patching, monitoring, and self-assessment remain.
Why a PCI compliant payment iframe matters
A PCI compliant payment iframe is a small frame, served from a payment provider's domain, that collects the card number inside your checkout without exposing it to your site. Because the frame lives on a different origin, the shopper's card data goes to the provider and not to you, which is what keeps most of your systems out of PCI scope.
The pattern is powerful, and also easy to undermine. Most of the trouble is not with the iframe itself but with how it gets integrated. Here are five mistakes that quietly cancel the protection a PCI compliant payment iframe is supposed to give you.
Mistake 1: Capturing the card before the iframe does
The point of the iframe is that the card number is typed into it directly. Some teams instead collect the card in their own input, then copy the value into the frame or send it to the provider through their backend. The moment your code holds the raw number, your systems are back in scope, no matter how briefly you keep it.
If you find yourself reading the card value in your own JavaScript, the design has gone wrong. Let the shopper type into the provider's field and take back only the token.
Mistake 2: Hosting or proxying the payment script yourself
The provider ships a script that creates and manages the iframe. To feel in control, some teams download that script and serve it from their own domain, or route it through their own server. Both moves can pull your infrastructure into the card data path and defeat the isolation.
Load the provider's script from the provider, exactly as documented, so the boundary stays where it belongs. Convenience here is not worth the scope it can add back.
Mistake 3: Letting untrusted scripts share the checkout page
The iframe protects the card fields, but the page around them is still yours. If you let analytics tags, chat widgets, or ad scripts load freely on the checkout page, any one of them could be compromised and attempt to skim data or overlay a fake field. PCI DSS has tightened its expectations here for good reason.
Keep the checkout page lean, vet every script that runs on it, and use controls like a content security policy so nothing unexpected executes.
Mistake 4: Logging what the shopper types
Verbose logging is a common source of accidental exposure. If your front end or server logs full form submissions, request bodies, or error payloads that include card data captured somewhere it should not have been, you can end up storing card numbers in log files you forgot you had.
Make sure nothing in your pipeline records the contents of payment fields, and confirm that error handlers do not dump raw input.
Mistake 5: Treating the iframe as the whole compliance story
An iframe removes card data from your environment. It does not secure your accounts, your servers, your API keys, or your policies. Teams sometimes assume the frame makes them compliant and stop there. You still owe access control, patching, monitoring, and the appropriate self-assessment.
Treat the iframe as the biggest single risk reducer, not the finish line.
How Flux is set up to avoid these
Flux serves its payment fields as origin-isolated iframes from payments.fluxpayments.com. The card number is captured inside those frames and tokenized, so your code never has to hold it, and there is no supported pattern that asks you to. Flux documents loading the script from its own domain, returns a token for storage and rebilling, and is SAQ-D Level 2 PCI DSS certified on the infrastructure that receives the card.
With that foundation, avoiding these five mistakes is mostly a matter of resisting the urge to reach into the frame. Let the iframe do its job, keep the surrounding page clean, and secure the systems that are genuinely yours.
Frequently asked questions
Can I read the card number from the iframe for validation?
No. Reading the value would defeat the isolation and put your code in scope. Validation happens inside the provider's frame, which returns a token and any error status you need.
Does a payment iframe cover the new script requirements in PCI DSS?
It helps by keeping card data off your page, but you still must manage the scripts that run on the checkout page. Vetting third-party scripts and using a content security policy address that separately.
Is one iframe enough, or do I need several?
Providers differ. Some render the card number, expiry, and code as separate iframes for finer isolation; others use one. What matters is that the sensitive input lives on the provider's origin, not yours.
Related reading
Ready to get set up with Flux?
Cards, ACH, and stablecoins in one platform, with volume-based pricing. No setup fees or contracts.
Get Started