Hyvä CSP migration
Make your Hyvä theme, checkout and modules CSP compliant, without breaking your checkout
Hyvä CSP migration, done and tested
Since Magento 2.4.7, the checkout runs its Content Security Policy in restrict mode by default, and PCI DSS 4.0 requires a strict policy on payment pages. Hyvä Checkout supports strict CSP out of the box, and Hyvä offers a CSP version of the theme. The catch is your own code: inline JavaScript that worked for years is now blocked by the browser, and a payment method, shipping selector or custom component silently stops working on the most important page of your store.
We migrate Hyvä themes, Hyvä Checkout customizations and Magento modules to strict CSP. We build and maintain payment and shipping integrations for Hyvä Checkout every day, so we know where CSP breaks things and how to fix it without losing functionality.
Why CSP is not optional anymore
PCI DSS 4.0: requirements 6.4.3 and 11.6.1 require you to control and monitor every script on payment pages. These have been mandatory since April 2025.
Magento 2.4.7+: the checkout runs CSP in restrict mode by default. Unknown inline scripts and unsafe-eval are not allowed.
Hyvä: Hyvä Checkout supports strict CSP out of the box, and Hyvä offers a CSP version of the theme built on the Alpine.js CSP build, which does not evaluate inline expressions. Which route fits depends on your store: strict CSP on the checkout only, or the full theme. Custom code and third-party modules need migrating either way.
What breaks during a Hyvä CSP migration
Inline Alpine expressions such as
x-data="{ open: false }"and@click="open = !open"Inline
<script>blocks that are not registered with$hyvaCsp->registerInlineScript()Payment SDKs and iframes loading from domains that are missing in
csp_whitelist.xmlThird-party modules that inject JavaScript into the checkout, often in code you cannot change directly
Magewire components in Hyvä Checkout that rely on inline JavaScript callbacks
A typical change looks like this. Every inline expression becomes a registered component:
<!-- Before: inline expressions, blocked under strict CSP -->
<div x-data="{ open: false }">
<button @click="open = !open">Toggle</button>
</div>
<!-- After: a registered component, CSP compliant -->
<div x-data="initToggle">
<button @click="toggle">Toggle</button>
</div>
<script>
function initToggle() {
return {
open: false,
toggle() { this.open = !this.open; }
};
}
window.addEventListener('alpine:init', () => Alpine.data('initToggle', initToggle), {once: true});
</script>
<?php $hyvaCsp->registerInlineScript() ?>How we migrate
1. Inventory: we scan your theme and modules for inline scripts, inline Alpine expressions and external sources, and list everything that needs work, ordered by risk.
2. Automated migration: we run the official Hyvä CSP migration tool to handle the repetitive changes.
3. Manual fixes: the tool does not catch everything. Complex components, Magewire callbacks, payment SDKs and third-party modules we fix by hand, with patches or compatibility modules where the vendor has not caught up yet.
4. Tight whitelist: we add only the sources you really need, per Magento area (frontend, admin), instead of opening up the policy.
5. Verified with end-to-end tests: we run Playwright tests through the complete checkout with CSP in restrict mode and fail on every CSP violation in the browser console. So you know it works, instead of hoping it does.
Why Control Alt Delete
Plenty of agencies can run a migration tool. What we add is checkout depth and testing. We have been building Hyvä Checkout integrations since it launched in 2023, for payment service providers and carriers used by thousands of stores. Those modules have to work under strict CSP in every store that installs them, so CSP compliance is part of our daily work, not a one-off project.
And because we specialize in end-to-end testing, you do not only get migrated code. You get a test suite that keeps your checkout CSP compliant after every update. Also see our Hyvä Checkout services.
Frequently asked questions
Rewriting the JavaScript in your Hyvä theme, Hyvä Checkout and Magento modules so it works under a strict Content Security Policy. That mainly means replacing inline Alpine.js expressions with registered components, registering inline scripts with Hyvä's CSP helper, and whitelisting only the external sources you need.
It handles a large part of the repetitive work, but not everything. Complex components, Magewire callbacks, payment SDKs and third-party modules usually need manual fixes. And after the tool runs you still need to verify that the checkout actually works.
That depends on the amount of custom code and third-party modules in your checkout. After the inventory you get a clear list of what needs to change and an estimate, before we start.
PCI DSS 4.0 requirements 6.4.3 and 11.6.1 require you to authorize, inventory and monitor all scripts on payment pages. A strict CSP is the most practical way for a Magento store to meet that.
Yes. We do this for payment and shipping modules that are installed in many stores, including Luma and Hyvä Checkout compatibility, with tests that run on every release.
Not always. Hyvä supports three routes: strict CSP on the checkout only, strict CSP on the checkout plus redirect-based payment buttons elsewhere, or a fully CSP compatible theme using the Alpine.js CSP build. Strict CSP on the checkout only is often enough and needs the fewest changes. If you have in-context payment buttons such as PayPal Express or Apple Pay outside the checkout, or want maximum protection, a larger migration makes sense. We help you pick the route before anything gets rewritten.
Need your Hyvä store or module CSP compliant?
Tell us what runs in your checkout. We make an inventory, migrate it, and prove it works with end-to-end tests.
Hyvä Checkout cases
Briqpay
Hyvä Checkout compatibility module for Swedish payment provider Briqpay: existing Magento payment flow brought natively to Hyvä Checkout, open source in Briqpay's repository, with end-to-end tests via GitHub Actions.
Colissimo
Open source Magento 2 module integrating Hyvä Checkout with Colissimo pickup points. Search by map or list, Google Places autocomplete, geolocation, and a high quality bar.
Correos
Integration of Correos pickup point selection within Hyvä checkout, featuring geolocation and manual address entry with list and map view options.
Elorn/P3
Custom Elorn/P3 credit card integration for Growlobby and Hyvä Checkout, eliminating redirects through iframe-based payment processing with 3D Secure authentication and tokenization, built with minimal documentation.