Most ecommerce projects are judged on design and speed to launch. Security comes up later, usually after a card-skimming script, a wave of account takeovers or a bot draining discount codes. By then it is expensive to fix, because the decisions that matter most were made at the start: which platform, how payments are taken, how customer accounts and APIs are built, and which plugins and scripts are allowed. This guide covers those decisions for teams building a custom store or rebuilding on a platform such as Shopify, WooCommerce, Magento or a headless stack.
Choose the platform with security in mind
Hosted platforms such as Shopify handle hosting, patching and much of payment security for you, at the cost of flexibility. Self-hosted platforms such as WooCommerce and Magento give full control and full responsibility: you patch the application, plugins, server and database. Headless and custom builds give the most freedom and the most code to secure. None is wrong, but be honest about who will keep the store patched for years after launch, because unpatched self-hosted stores are a common target for skimming attacks.
Keep card data out of your systems
The simplest way to reduce payment risk and PCI DSS scope is never to handle card numbers yourself. Use your payment provider's hosted payment page or embedded fields, so card data goes straight from the customer's browser to the provider. Your PCI obligations then shrink to a shorter self-assessment, though not to zero. PCI DSS 4.0 requires merchants to keep an inventory of scripts on payment pages, authorise each one and detect unauthorised changes, because attackers who inject a script into the checkout can still capture card details as they are typed.
Customer accounts and login security
Credential stuffing, where attackers try passwords leaked from other sites, is constant against ecommerce logins. Rate-limit login and password reset, add bot detection, offer MFA or passkeys, check new passwords against known breached lists and alert customers to new-device logins. Protect stored value such as gift cards, loyalty points and saved payment methods with extra checks, because that is what attackers cash out.
Build APIs that check every request
Modern stores run on APIs for carts, orders, accounts and inventory. The most common serious flaw is an API that trusts an ID from the client: change the order number in a request and see someone else's order, address and phone number. Every API call must check that the logged-in customer owns the record. Validate prices and quantities on the server, never from the cart in the browser, and rate-limit endpoints that bots abuse, such as coupon checks and stock lookups.
Plugins, apps and third-party scripts
Every plugin, app and tag is code from someone else running in your store. Install only what you need from reputable sources, keep it updated, remove what you no longer use and review the permissions apps request, since many ask for full access to orders and customer data. Keep an inventory of front-end scripts, set a Content Security Policy that limits where scripts can load from, and monitor payment pages for changes.
Protect customer data and meet privacy law
Collect only the data you need, encrypt it, restrict who on your team can export customer lists and keep admin panels behind MFA and, where possible, an IP restriction. Privacy laws such as India's DPDP Act, GDPR for EU customers and US state laws set rules on consent, retention and breach notification. Build consent capture and data deletion into the store from the start rather than retrofitting them.
Bots, fraud and availability
Sales and launches attract bots that buy limited stock, test stolen cards and scrape prices. Use a CDN with bot management and a web application firewall, add velocity checks on orders and card attempts, and load-test before big campaigns so the store stays up when traffic peaks.
Secure the admin side and the build pipeline
Attackers often go for the back office rather than the storefront. Put the admin panel on its own path with MFA for every staff account, give staff only the roles they need, and remove accounts when people or agencies stop working with you. For custom and headless builds, protect the deployment pipeline as well: keep secrets out of code repositories, review dependencies for known vulnerable or malicious packages, and require review before code reaches production. A compromised developer account or build server can inject a skimmer as easily as a compromised plugin.
Test before launch and after big changes
Run a penetration test before launch and after major releases, covering the storefront, checkout, customer accounts, APIs and admin panel. Fix the findings, retest, and keep scanning between tests. Our VAPT services test ecommerce platforms end to end, and for payment-specific requirements see PCI DSS penetration testing. The free PCI SAQ selector helps you work out which self-assessment applies, and our ecommerce page covers how we support online brands.
Frequently asked questions
Which e-commerce platform is most secure?
How do we shrink our PCI DSS scope?
What is card skimming?
How often should the store be pentested?
Launch a store that is safe as well as fast
We test storefronts, checkouts, APIs and admin panels before launch and after big releases, with the retest included.

