<script> tag directly to your page.
Both paths converge on the same CDN artifact. The npm package is a thin typed loader that injects the CDN URL at runtime.
Publishable keys
The SDK is initialized with a publishable key. The key prefix selects the API environment:
Your secret key stays on your server and is used to authorize the tokenized payload the SDK returns.
Option 1: npm
/pure instead:
loadOverflow from client-only code such as an effect or event handler.
TypeScript types without runtime import
If you use a bare<script> tag and want editor types, add the package as a devDependency and reference the ambient types:
Latest-only policy
The npm loader always injects the floatingv1 CDN URL. Pinning and Subresource Integrity are not supported through the loader. If you need pinning or SRI, use the script-tag install described below.
Option 2: script tag
Choose a versioning strategy
Every deployment of the SDK is available under two URL shapes:Floating URL (recommended default)
- Always serves the latest v1 release.
- Cached at the edge for 5 minutes, so patch releases roll out within minutes.
- You get bug fixes and non-breaking improvements without redeploying your site.
- Cannot be used with Subresource Integrity, the file changes on each deploy.
Pinned URL (for SRI or strict change control)
- Immutable: the artifact at a pinned version never changes.
- Cached for one year at the edge.
- Compatible with Subresource Integrity (see below).
- You control the upgrade cadence by updating the version in your HTML.
Subresource Integrity (SRI)
SRI is available on pinned script-tag installs. Fetch the sidecar hash for the version you want:sha384-<base64>. Copy it verbatim into the integrity attribute and set crossorigin="anonymous" so the browser can enforce integrity on the cross-origin script.
openssl:
Environment hosts
For each environment, the same URL shapes exist under a different host:
The host does not determine which Overflow API is called. The publishable key does:
live_pub_… always routes to production, test_pub_… always routes to staging.
Preload for above-the-fold checkout
If checkout is critical to first paint, preload the bundle from<head>:
integrity attribute on both tags.
Do not preload on landing pages where the shopper may never reach checkout. Unused preloads waste bandwidth and log a console warning.
Content Security Policy
If your site sets a Content Security Policy, allow the CDN host inscript-src and connect-src:
https://cdn-stage.overflow.co and https://server.stage.overflow.co.
If you use address autocomplete, add https://maps.googleapis.com to script-src and connect-src. See Address autocomplete.
Next steps
Quickstart
Render your first payment form.
Concepts
Elements, options, events, and theming.