Paddle Checkout and CSP: Why Allowing paddle.js Was Not Enough
Our live pricing page returned HTTP 200 while CSP blocked Paddle CSS and Retain. Here is how we traced the missing origins and tested the fix without real payments.
The payment page returned 200. The browser still blocked its dependencies.
DeployWatchers found this on its own pricing page. Its browser JavaScript check reported CSP violations after we enabled live Paddle checkout. The page itself returned HTTP 200. Paddle's main JavaScript file was allowed by our Content Security Policy. That was not enough.
The browser reported two distinct restrictions:
Loading the stylesheet
https://cdn.paddle.com/paddle/v2/assets/css/paddle.css
violates: style-src 'self' 'unsafe-inline'
Loading the script
https://public.profitwell.com/js/profitwell.js
violates: script-src 'self' ... https://cdn.paddle.com
We have omitted the query string from the second URL. Debugging this did not require publishing our client token or any customer identifiers.
This was a policy defect in our integration, not evidence that Paddle was unavailable. It also did not establish that every payment failed. The evidence was narrower: the page could load, while the browser refused resources used by the payment integration. Checkout styling and Retain functionality needed separate investigation.
The fix was to account for the integration's resource graph, rather than treating its entry-point script as its only dependency.
The same self-check also found a third-party cookie
The cookie check on that page reported three cookies, including one third-party cookie: __cf_bm on paddle.com. Its tracking-cookie count was zero.
This was a second finding from DeployWatchers itself, but it meant something different. The JavaScript check had exposed resources blocked by our policy. The cookie check had correctly identified a cookie on a provider's domain; our rule that warned about every third-party cookie was too coarse for this known security-cookie case.
Cloudflare documents __cf_bm (opens in a new tab) as part of its bot protection. We kept the cookie visible as third-party metadata and introduced a narrow classification for the secure __cf_bm cookie on exactly paddle.com. Unknown third-party cookies and recognized tracking cookies still produce warnings. We do not exempt the same name on an unrelated domain.
That distinction matters: a monitoring finding needs interpretation. Neither the absence of recognized tracking cookies nor our security-cookie classification is a legal assessment of consent compliance. We also updated our Cookie Policy to describe the provider-domain cookie explicitly.
Why our sandbox checks did not cover the live behavior
Paddle.js integrates both Checkout and Paddle Retain. According to the Paddle.Initialize reference (opens in a new tab), Retain is not loaded for sandbox accounts. Live client-side tokens authenticate the integration with Billing and Retain.
That difference mattered. Our sandbox CSP already allowed the sandbox API and checkout iframe, but exercising sandbox checkout could not demonstrate that the live Retain script would be permitted.
The stylesheet issue was separate: our policy omitted Paddle's stylesheet origin. That could be found without a live payment and was not inherently a sandbox/live difference.
These were two gaps in our verification:
- We checked the main SDK script without checking its stylesheet.
- We treated sandbox coverage as if it exercised the additional live integration.
A useful test matrix needs both environments. It does not need to charge a real card just to discover which resources the initial page requests.
A permitted script does not permit its stylesheet
Our simplified policy looked like this:
script-src 'self' https://cdn.paddle.com;
style-src 'self' 'unsafe-inline';
A script may run and then append a stylesheet element to the document. The browser still evaluates that stylesheet request under the style policy. Adding a host to script-src does not add it to style-src.
In our console message, the browser specifically noted that style-src-elem was absent, so it used style-src. We added Paddle's CDN to that directive:
style-src 'self' 'unsafe-inline' https://cdn.paddle.com;
The existing inline-style permission is shown because it was already part of our application policy. It is not a new requirement established by this incident, nor a recommendation to add it to every site. See the style-src reference (opens in a new tab) for the directive's scope.
If your application defines style-src-elem explicitly, inspect that directive too. Changing a fallback does not necessarily change the effective restriction.
Retain introduced another script origin
Our live page loaded Paddle.js from cdn.paddle.com. That SDK then attempted to load Retain from public.profitwell.com.
The referring script was trusted. The new script URL was not automatically trusted by our host-based policy.
We added the observed Retain origin to script-src, but only for enabled live checkout pages:
script-src 'self' https://cdn.paddle.com https://public.profitwell.com;
If script-src-elem is explicitly configured, check that effective directive as well. This is a shortened directive to illustrate the added origins. Our application has its own existing script permissions; the snippet is not a complete policy to paste over them.
Allowing the script also exposes its subsequent requests. We inspected the official Retain script and identified production connection and widget origins. That review gave us a candidate allowlist; merely finding a URL in a script does not prove that a particular customer session will request it.
Our production additions were:
| Resource | Directive | Added origins |
|---|---|---|
| Checkout stylesheet | style-src |
https://cdn.paddle.com |
| Retain entry script | script-src |
https://public.profitwell.com |
| Retain connections | connect-src |
https://www2.profitwell.com, https://retain-api.profitwell.com, https://api.profitwell-events.com, https://retain-widgets-api.paddle.com |
| Retain widget | frame-src |
https://retain-widgets.paddle.com |
This supplements our existing Paddle API and checkout-frame rules. It is an integration-specific snapshot, checked in November 2026, not Paddle's universal or permanent CSP specification. We did not allow the development or staging origins present in the script.
The separate connect-src (opens in a new tab) and frame-src (opens in a new tab) directives matter here: permitting JavaScript execution does not automatically permit its fetch requests or embedded frames.
Keep the exceptions on the pages that load the SDK
In our Laravel application, Paddle.js initializes on /pricing and /checkout when checkout is enabled. The homepage, blog, legal pages and login page do not need the same resource permissions.
An illustrative middleware extension looks like this, assuming $directives already contains the application's baseline policy as arrays of source expressions:
if (config('paddle.enabled') && $request->routeIs('pricing', 'checkout')) {
$directives['script-src'][] = 'https://cdn.paddle.com';
$directives['style-src'][] = 'https://cdn.paddle.com';
if (config('paddle.environment') === 'production') {
$directives['script-src'][] = 'https://public.profitwell.com';
$directives['connect-src'] = array_merge(
$directives['connect-src'],
[
'https://www2.profitwell.com',
'https://retain-api.profitwell.com',
'https://api.profitwell-events.com',
'https://retain-widgets-api.paddle.com',
],
);
$directives['frame-src'][] = 'https://retain-widgets.paddle.com';
}
}
This is the additional-resource portion, not a complete middleware. You must also retain the correct Paddle API and checkout-frame origins for your environment. When serializing source lists, remove 'none' before adding allowed origins; do not treat it as another host in a populated directive.
We kept the environment explicit. Sandbox received the stylesheet permission and its existing sandbox checkout permissions, but no live Retain exceptions.
We also avoided wildcard exceptions such as permitting every HTTPS script. The application needed a small set of named origins on two routes, not a global relaxation of its policy.
Reproducing the failure without payments or external requests
To check the browser behavior independently, we built a small synthetic SDK fixture and ran it in Chromium inside a Docker container with external networking disabled.
Three local HTTP origins represented the application, its SDK CDN and an additional service. The SDK fixture appended a stylesheet and a second script. That second script attempted a fetch and embedded a widget iframe.
We ran three policies:
| Policy stage | Observed result |
|---|---|
| Main script permitted | Stylesheet and second script blocked |
| Both scripts and stylesheet permitted | Styles loaded and second script ran; fetch and frame blocked |
| Required resource directives permitted | Styles, script, fetch and widget loaded; no CSP violations recorded |
Chromium reported style-src-elem and script-src-elem violations in the first stage, followed by connect-src and frame-src violations in the second. This demonstrates why fixing only the first console message is insufficient.
The experiment used local stand-ins. It did not execute Paddle Checkout, contact Paddle or prove that a real transaction could complete. Its purpose was to verify the CSP mechanics with a reproducible browser test, rather than assume that matching a string in a response header was sufficient.
Turn the origin list into regression tests
We added application tests that parse the generated policy into directives. For live pricing, the assertions check the stylesheet, Retain script, connection and frame permissions separately.
The negative assertions are just as important:
- Sandbox must not inherit live Retain permissions.
- The homepage, blog, privacy page and login page must not inherit payment-page exceptions.
- Disabled checkout must not keep the payment-page exceptions.
- Production must not include sandbox, staging or development hosts.
Those tests passed alongside our existing security suite. They verify our response headers and route scoping. They do not replace a browser check of the deployed page.
For a browser-level assertion, collect policy violations before navigating:
await page.addInitScript(() => {
window.cspViolations = [];
document.addEventListener('securitypolicyviolation', event => {
window.cspViolations.push({
directive: event.effectiveDirective,
blocked: event.blockedURI,
});
});
});
await page.goto(pricingUrl);
Then wait for the specific integration state you expect and inspect the recorded violations. Avoid relying on an arbitrary short sleep or on the page's HTTP status alone. Keep full blocked URLs out of shared logs when query strings could contain identifiers.
What we check after deployment
We inspect the actual document response headers, not only the middleware source. A reverse proxy or CDN can add another enforcing policy, and an HTML CSP meta element may impose an additional restriction. Multiple policies do not combine into a larger allowlist; the browser enforces each policy. MDN explains this in its multiple-policy documentation (opens in a new tab).
Our release checks now distinguish:
- The page returned a successful response.
- The intended scripts, styles, API requests and frames were permitted.
- Checkout opened with the correct plan and billing interval.
- A separately authorized payment test confirmed the webhook and access-provisioning path.
Completing the first two does not prove the last two. Likewise, a clean console does not prove that a checkout button exists, works or completes a purchase.
For us, this incident was a useful reminder about post-deployment monitoring: an HTTP 200 can coexist with browser-enforced failures. The actionable signal was the blocked resource and its effective directive, not simply whether the pricing page was reachable.
Catch problems after your next deployment
Monitor availability, browser JavaScript errors and visual changes with DeployWatchers.