JavaScript SDK
You can use the Real ID JavaScript SDK for advanced custom use cases to trigger ID checks without relying on the built-in triggers available in the before checkout flow.
The JS SDK lets you to programmatically require ID verification gates at any time on the frontend of your site.
Getting Started
If you have the before checkout flow enabled and are working with an Online Storefront page in Shopify or WooCommerce, then SDK will be included automatically.
But if you have no automatic verification enabled or are working on a custom page outside of the online store, then you'll need to install the SDK on your site. Include the script tag to install it:
<script type="text/javascript" src="https://www.idv.link/assets/index.js">
Then this script tag will load the RealID
object into your browser window.
You'll need to use an HTTPS server for a secure connection in order to properly load the assets for the SDK as well as access the customers camera during verification.
Creating an ID verification gate
You can initialize a new ID verification prompt by using the RealID.createFlow
method. This method accepts a target
which will be used to replace the target with the ID verification prompt.
After the customer verifies their ID, then they'll be able to see the target
again.
// Create a new ID verification gate
RealID.createFlow({
// override the Checkout button until the customer is verified
target: ".checkout-btn",
});
Real ID will automatically replace all elements with an ID verification prompt.
At this time the JS SDK only supports Shopify & WooCommerce, since we can infer your stores settings from these platforms.
Removing the ID verification gate
You can also remove the ID verification gate by calling RealID.unmount()
.
This will unmount all Real ID flow instances on your frontend immediately, and will restore the target
elements.
// immediately remove the ID gates from the page and restore any hidden elements
RealID.unmount();
Frequently Asked Questions
How do I know if the Real ID JS SDK is available in the current page in Shopify?
Within your browser's JavaScript console, enter in window.RealID
. If the result is undefined
, then that means you need to install the JS SDK on that page.
Will already verified repeat customers be verified automatically?
Yes, the SDK will automatically detect if the customer is logged in and has already verified their ID. Or if they are not logged in, then the SDK will find their prior ID check from the customer's email address when they start the flow.
The same methods to remember repeat verified customers for the before checkout flow are used for this SDK.
Will my theme and rules be applied?
Yes, the Real ID JS SDK will automatically apply the rules, content and theme you've set up in the settings page of the app.
Can I use this on any website outside of Shopify & WooCommerce?
No, but that is coming soon. You'll be able to use this JS SDK to implement ID verification gates on any website.
Will this work within a Liquid Snippet in my Shopify Theme?
Yes, you can write JavaScript within a Liquid Snippet. Depending on if the page you're adding the snippet to is within the Storefront then you can skip the installation step.
Will this work within a Shopify Checkout Extension?
No, Shopify Checkout Extensions don't allow you to write arbitrary HTML. However, you can use our Shopify app checkout block to require ID verification during or after checkout.