Inttegro Web SDKs - v0.1.0
    Preparing search index...

    Function loadInttegro

    • Loads and validates the Inttegro-hosted Checkout runtime.

      In a browser, the first call appends one asynchronous script from INTTEGRO_JS_URL. Concurrent and subsequent calls share the same promise so a page never initializes competing runtimes. If loading fails, the loader removes the script it created and clears the cached promise so a later user-initiated retry can try again.

      During server-side rendering, the function resolves to null without touching the DOM. Call it from a browser lifecycle hook or explicitly guard the result before creating Checkout.

      The loader accepts a pre-existing script only when its exact src matches INTTEGRO_JS_URL; a compatible-looking window.Inttegro global on its own is rejected. This protects the controlled-origin boundary, but does not replace your own CSP, dependency review, or server-side Order authorization.

      Parameters

      • options: InttegroLoadOptions = {}

        Browser loading options. The nonce is used only when this call creates the shared runtime script.

      Returns Promise<InttegroRuntime | null>

      The validated runtime in a browser, or null during SSR.

      InttegroCheckoutError by rejecting with invalid_runtime, runtime_load_failed, or runtime_load_timeout.

      const inttegro = await loadInttegro({ nonce: window.__cspNonce })
      if (!inttegro) return // Server-side render

      const checkout = inttegro.createCheckout({ orderId })
      checkout.on('completed', () => location.assign('/orders/complete'))
      await checkout.mount('#checkout')