JS-SDK

 

JavaScript

Create a custom verification integration in your web app. Upon positive verification, receive a unique token to send to our REST API for validation.

REST API

Positive verifications result in a unique access token, which you can securely pass to our REST API for validation and identifying information about the User.

Who should use the JavaScript SDK?

Most Businesses using VerifyPass to offer a verified discount don’t need the JS-SDK.

Easier options exist, including customized landing pages or copy/paste code snippets for integrated verification. However, some Businesses prefer the custom functionality of a JavaScript Software Development Kit. The JS-SDK allows the Business to modify what happens before and after verification.

Quick Start

Compatible across all major browsers. JS-SDK authenticates Users with VerifyPass and returns token sent to REST API for validation.

CDN
<script src="https://cdn.verifypass.com/seller/launcher.js"></script>
This is the only script you need to integrate the JS-SDK.
HTML
<button type="button" id="myBtn">Open</button>
Basic Example
VFYPS.verify({
  pub_key: "{your public key}",
  initializer: document.getElementById("myBtn"),
  onSuccess: function(token){
    console.log(token); //Send to your backend for REST API validation
  }
});
Documentation

JS-SDK required and optional parameters.

Required Parameters
Parameter Type Description
initializer HTML Object Elements assigned to launch verification. Can be a single element getElementById() or array of elements getElementsByClassName(). Also compatible with jQuery, for example $("#myBtn") or $(".myClass").
onSuccess Function Handles the return of a token, which is returned as a String. In most cases, you'll perform either AJAX or a standard POST request to your app with the token to be validated via IDS REST API.
pub_key String Public key is found in your account page after enrolling in a Plan.
Optional Parameters
Parameter Type Description
message String Overrides default Discount Description (within Settings). Note: Business Name may not be overridden.
onLoad Function Callback for popup load success. This means your Public Key was accepted and the User reached authentication prompt.
onClose Function Callback for popup closing.
Token Validation

Validate your User access token from the JS-SDK. All responses are in JSON.

Single Endpoint
POST https://verifypass.com/token/{token}
Required Parameters
Parameter Type Description
private_key String Private Key is from your account. Private Key must be from the same initiating account Public Key belonged in the JS-SDK.
Response
Tokens reference a unique occasion of a verification. Regardless whether a User belongs to multiple groups, the API will return truthy/falsy based on the token affiliated with the unique verification. Possible groups are mil, edu, fir and tea.
{
    "email": "customer@example.com",
    "first_name": "John",
    "group": "mil",
    "last_name": "Smith",
    "verified": true
}
Response (Error)
{
    "error": "Invalid token."
}