RadiumOne is the SDK’s factory class. You get an instance either synchronously from the CDN global, or asynchronously via the npm loader.
RadiumOne.init() is synchronous — don’t await it. loadRadiumOne() (npm only) is the async one, since it also injects the CDN script.
RadiumOne.init(publishableKey, options?)
Create a RadiumOne instance from a publishable key (CDN usage). npm users call loadRadiumOne instead.
Accepted keys depend on the bundle’s channel: - Production bundle (js.radiumone.io): r1pk_prod_* only. - Sandbox bundle (js-sandbox.radiumone.io): r1pk_test_* and r1pk_mock_* (the mock suffix must be 1–32 characters of a-z, 0-9, _ or -).
r1pk_test_* keys use the sandbox API; r1pk_mock_* keys never call the API (see BindResult.mock).
Returns RadiumOne — A new RadiumOne instance.
Throws:
urn:radiumone:elements:init:invalid-key(api_error) — key missing or not a string.urn:radiumone:elements:init:secret-key-used(api_error) — a secret key (r1sk_*) was passed.urn:radiumone:elements:init:test-key-in-prod-build(api_error) —r1pk_test_*key on the production bundle.urn:radiumone:elements:init:prod-key-in-staging-build(api_error) —r1pk_prod_*key on the sandbox bundle.urn:radiumone:elements:init:invalid-key-format(api_error) — any other malformed key.
Instance
elements(options?)
Create a group of card Elements.
Returns Elements — A new Elements group.
threeDS()
Create a 3D Secure coordinator for this key.
Use one instance per concurrent 3DS flow. Unlike card Elements, 3DS runs on your page, so your CSP must allow the gateway API origin in connect-src and challenge origins in frame-src / form-action; see the Content Security Policy guide.
Returns ThreeDS — A new ThreeDS instance.
loadRadiumOne(publishableKey, options?)
Load the SDK bundle from the RadiumOne CDN and initialize it with a publishable key. The npm entry point.
- Injects a version-pinned
<script>with Subresource Integrity:js.radiumone.ioforr1pk_prod_*keys,js-sandbox.radiumone.ioforr1pk_test_*/r1pk_mock_*keys. Your CSP must allow that origin inscript-srcandframe-src(see the Content Security Policy guide). - Reuses an SDK already loaded via<script>instead of injecting another. - Test keys with the npm package: the published package carries the production hash only, so add the sandbox CDN<script>tag (noasync/defer) before your app bundle.loadRadiumOne()reuses its global. Without it, a test key throwsloader:integrity_unset. Remove the tag when switching to a live key. - One instance per page: later calls return the first promise; a different key logs a warning and is ignored. - Returnsnullwhenwindowis undefined (server-side rendering). - Rejects if the script does not load within 10 seconds; a failed load can be retried.
RadiumOne.init() runs are plain Errors (no code): missing key, secret key, unrecognised prefix, CDN load failure or timeout, and a package built for the other channel (message contains loader:integrity_unset).
Returns Promise<RadiumOne | null> — The RadiumOne instance, or null during server-side rendering.
Throws:
Error— invalid or secret key, CDN load failure, timeout, or channel mismatch (see remarks).urn:radiumone:elements:init:*— key rejected byRadiumOne.init.
Constants
Public mock-mode key for demos and documentation. Works only with the sandbox bundle; tokenization is simulated and
BindResult.mock is true.ElementsError.code when the gateway rejects the card iframe’s script attestation (urn:radiumone:payment-gateway:auth:invalid-script-hash). Not retryable; there is no customerMessage, so show your own copy.Co-defined (kept in sync) in iframe-host bind-client.ts.Example
Errors
See Elements SDK errors for the fullElementsError reference.