Run one of the following commands at the root of your javascript project to install the SDK.
Using npm:
npminstall--save@payscore/web-widget-sdk
Using yarn:
yarnadd@payscore/web-widget-sdk
Please make sure your package version is at least 1.0.0
Selecting an Appropriate Environment
Payscore provides two environments for usage with the web-widget-sdk.
staging is used to develop and test your integration.
production is used for your application’s live environment.
Developers should be aware that API calls to create an applicant group and widget token will require you to use the same environment you are passing into the widget configuration.
Obtaining an Access Token
To interact with the Payscore API, you must first generate an access token and attach the token to the Authentication header to authenticate requests. To accomplish this, follow the instructions found in the Authentication Documentation.
Creating a Applicant Group for the Applicant
Before you load the embedded widget, an applicant group needs to be created for the applicant. For instructions on creating an Applicant Group, please see our Applicant Group Documentation. Make sure you set the is_invitation_disabled parameter to true to avoid sending an email or a text message invite to the applicant.
Once an applicant group is created, store the applicant IDs for each applicant within the group. That applicant id is how Payscore knows which applicant’s verifications to show in the embedded widget.
Generate an Authenticated Widget Token for the Current Applicant
To generate a widget token, you make a GET request to the /api/v1/applicants/{applicant_id}/widget_token endpoint from your back-end with the following headers, and will receive the following response. We recommend adding a proxy endpoint in your backend that your front-end calls to obtain the widget token.
Incorporating the SDK
To use the widget, see the code example below. We recommend producing a new widget token every time you open the embedded widget.