Versa Link is the client-side component that your users will interact with in order to link their accounts to your app. It handles all aspects of the account linking experience.
Versa Link is one method of customer registration, in which most of the work is handled via the embeddable widget. Alternatively, you are welcome to implement your own customer registration via the Versa API.
IMPORTANT
The only way to support OAuth-based connections (including Brex, QuickBooks, and Xero) is via Versa Link. The customer registration API does not support OAuth connections. Versa Link is the best way to ensure the broadest compatibility.
First, make an account at https://app.versa.org and issue yourself test credentials.
Before you can initialize Versa Link, you need to create a link token. Use your server-side credentials to acquire a short-lived token to pass to the client (tokens expire after 10 minutes).
In production, you will need to create a secure endpoint on your server that generates this token and returns it to your client application on behalf of the logged-in customer.
If you would like to customize the appearance of the Versa Link widget, you can do so by passing an optional theme object to the initialize method.
Field
Type
Description
viewMode
enum
One of modal or inline. Defaults to modal. See below for a comparison of the modal and inline themes.
IMPORTANT
For the 'inline' view mode, you must include a container element in your HTML with the id versa-canvas. The Versa Link script will query for this element by id and render the widget inside. See example below:
index.html
<body><divid="versa-canvas"><!-- Versa Link widget will render inside this canvas --></div><scriptsrc="https://cdn.versa.org/link/stable/versa-link.iife.js"></script><script>
(asyncfunctioninitInline() {
const response = awaitfetch("/api/link-token");
awaitVersaLink.initialize({
linkToken: data.token,
theme: {
viewMode: "inline",
},
});
// Immediately open; widget will render into #versa-canvasVersaLink.open();
})();
</script></body>
If there are additional theming customizations you would like to make, please reach out to the Versa team.
By default, Versa Link will offer all available integrations to the user. If you would like to limit the integrations that are offered, you can do so by passing an optional whitelistOrgs array to the initialize method. Reach out to the Versa team if you would like help identifying the org ids of the integrations you would like to offer.
When a user completes a connection, the onSuccess callback receives a response object. This object contains information about the changes that occurred during the Link session, and the current state of all connections.
onSuccess Example
VersaLink.initialize({
linkToken: data.token,
onSuccess: (res) => {
res.changes.forEach((change) => {
if (change.action === "enabled") {
console.log(`Connected to ${change.org.name}`);
} else {
console.log(`Disconnected from ${change.org.name}`);
}
});
console.log(`Total active connections: ${res.connections.length}`);
},
...
});
The response object includes changes and connections:
{"changes":[...],"connections":[...]}
Property
Type
Description
changes
array
What changed in this Link session. See change object definition.
Versa periodically updates Link to add new functionality and improve conversion. These changes will be automatically deployed. Any test suites and business logic in your app should be robust to the possibility of changes to the user-facing Link flow. Any major changes, especially those related to the inline view mode, will be shared with partners well in advance of deployment.