Option 1: Add a script tag
Load the browser bundle before your integration code:window.WeGive.Pay. The integrity value pins the file’s
contents as well as its URL. Change both together when upgrading. Do not add
async unless your application explicitly waits for the SDK to load before
calling it. If your site forbids inline scripts, put initialization in an
allowed external script or use your site’s nonce-based script policy.
Option 2: Import the ES module from its URL
Option 3: Download and vendor a release
For a script-tag integration, downloadwegive-pay.iife.js, verify its checksum,
and serve it from your application’s static assets. Keep the version in your
local path, for example /vendor/wegive-pay/v0.1.0/wegive-pay.iife.js.
For an ES module or bundled integration, download every runtime .js file
listed in release.json, preserving
their filenames and relative paths. Download the .d.ts files too if you use
TypeScript. Downloading only wegive-pay.js leaves out the Payframes companion
module.
This Node.js script downloads and verifies the runtime files and type
declarations into a local vendor directory. Save it as download-wegive-pay.mjs
and run node download-wegive-pay.mjs:
index.d.ts exports the public declarations. You
can import types from that file while importing runtime code from wegive-pay.js:
wegive-pay.d.ts adapter that re-exports the release’s declarations:
Available release files
Frameworks and browser policies
Initialize the SDK in browser code after the mount elements exist. In applications with server rendering, use a client component or browser-only lifecycle hook. Create one instance per active key configuration; do not reinitialize on every render. Mount once and clean up on route or component removal usingbutton.unmount() or fields.destroy().
Allow the SDK origin in your content security policy, along with the WeGive API,
secure-field, and verification resources required by your enabled integration.
Tokenization loads third-party frames and scripts in addition to the SDK file;
ask WeGive for the applicable allowlist if your site uses a restrictive policy.
Do not disable verification scripts or use a policy that severs the checkout
window’s connection to its opener. Test browser isolation policies with your
actual integration.
Continue with hosted checkout
or Payframes.