Content Security Policy
How ngx-stripe and Stripe.js fit together
Happy to help with either — this note just points you to the fastest answer. ngx-stripe wraps Stripe.js for Angular (DI, Observables, CDN loading, Element hosts). Stripe.js owns Element appearance, payment methods, validation copy, and PCI. For styling, placeholders, installments, and Element options, Stripe’s docs are usually the best first stop; for Angular setup and our components, you’re in the right place. See also FAQs, CSP, and Stripe.js.
Enterprise apps often fail Stripe Elements because the CSP blocks the Stripe.js CDN or Element iframes. ngx-stripe injects
Minimal allowlist
Prefer Stripe’s official CSP guidance and adjust to your policy engine. The snippet below is a starting point, not a complete production policy.
Content-Security-Policy:
default-src 'self';
script-src 'self' https://js.stripe.com;
frame-src https://js.stripe.com https://hooks.stripe.com;
connect-src 'self' https://api.stripe.com;
img-src 'self' https://*.stripe.com;
# Only if you enforce Trusted Types on scripts:
# trusted-types angular angular#unsafe-bypass ngx-stripe;
# require-trusted-types-for 'script';- script-src — Stripe.js from
https://js.stripe.com - frame-src — Element iframes and 3DS / bank redirects (
js.stripe.com ,hooks.stripe.com ) - connect-src — API calls to
https://api.stripe.com
Full reference: Stripe CSP guide.
Trusted Types
Most apps load Stripe.js with a plain CDN string. If your CSP enforces Trusted Types (
