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. - You call
loadRadiumOne()(npm or React) with a test key, and the sandbox CDN<script>tag isn’t on the page yet — it’s missing, or it loads after your app bundle (async,defer, or placed after the bundle).loadRadiumOne()throws anErrorwhose message containsloader:integrity_unset. Put the tag in<head>, before your app bundle, as a plain<script>(in Next.js,strategy="beforeInteractive") — see Test keys with npm or React. - 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
- With live keys, 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 production CDN tag directly (live keys), 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. The sandbox tag for test keys loads the floating/elements/v1/path with nointegrityattribute, so an SRI mismatch there means a hash was added by mistake — remove it. - Testing npm or React with a test key: load the sandbox tag only in test builds, so it can’t reach production with your live key.
- 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.