loadRadiumOne() (npm) or the CDN <script> tag can fail to load — from a blocked network request, a Subresource Integrity (SRI) mismatch, or a slow connection. Detect this before the shopper reaches the pay button.
TL;DR:
loadRadiumOne() rejects, or the CDN script never runs → catch it, check CSP/SRI first, then retry once before falling back to a page reload.When this happens
- The CDN script request is blocked or fails (ad blocker, firewall, DNS failure, offline).
- The request doesn’t complete within 10 seconds —
loadRadiumOne()enforces a fixed 10-second deadline and rejects if the script hasn’t loaded by then. - The browser’s own SRI check fails (the
integrityhash on the<script>tag doesn’t match the fetched file). This blocks the script silently — noerrorevent, no rejected promise — because it’s the browser’s own security enforcement, not the SDK’s.
What you see
What to do
1
Catch the rejection
Wrap
loadRadiumOne() in a try/catch (or handle the rejected promise) and show a fallback — don’t let an unhandled rejection block the rest of your checkout page.2
Rule out CSP or SRI first
Check the browser console for a Content Security Policy or SRI violation before assuming a network issue. See Content Security Policy for the
script-src/frame-src directives Elements needs, and Subresource Integrity for the integrity hash.3
Retry once, then stop
A transient network blip can resolve on a single retry. Don’t retry in a tight loop — if the second attempt also fails, show the fallback and let the shopper reload the page instead.
Prevent it
- Load with npm (
loadRadiumOne()) rather than a hand-copied CDN tag — the SRI hash is baked in at publish time, so there’s nothing to get out of sync. See Install and load Elements. - If you use the CDN tag directly, pin the immutable
/elements/v<X.Y.Z>/path and copy theintegrityhash from that version’s release notes, not from the manifest served at the same path. - Roll out CSP changes as
Content-Security-Policy-Report-Onlyfirst so a missingscript-src/frame-srcdirective shows up in reports instead of silently blocking the SDK in production.
Test it
See Test your integration for sandbox test cards and scenarios.Related
Install and load Elements
npm, CDN, and React install paths, plus key-validation errors.
SDK and integration errors
The full integration and SDK error code table.