Prerequisites
Before you start, ensure that you have:- A valid invite token for the customer or applicant who is to be onboarded
- Node.js and npm installed in your project
Add a mount target
Add an empty element to your page wherein the onboarding flow should render. SDK 3 mounts directly into this element
Create the onboarding instance
Call Use
createWorthOnboarding with your invite token and lifecycle callbacks:apiBaseUrl only if you’re targeting a non-production or non-default Worth API environment:Mount the SDK
mount() is asynchronous and accepts either a CSS selector string or an HTMLElement. It resolves once the onboarding flow has rendered into the targetmount() returns a promise, wrap it in a try/catch if you want to handle mount-time failures separately from runtime errors reported through onErrorPutting It Together
Using SDK 3 in a Framework
The example above is illustrative vanilla TypeScript. In component-based frameworks like React, create the instance once, mount it when the component mounts, and unmount it in your cleanup function:Content Security Policy
SDK 3 injects its scoped runtime styles automatically duringmount(). If your host page enforces a strict style-src Content Security Policy, pass your page’s request-level nonce with styleNonce:
Handling Errors
onError receives a WorthOnboardingError, which includes a code that you can branch on. See Error Handling for a complete list of error codes.
Next Steps
- See API Reference for complete API documentation
- Migrating from SDK 2? Read the Migration Guide