Embedded accounting
Use our JavaScript SDK to embed stub into your own web application
Last updated
Use our JavaScript SDK to embed stub into your own web application
Last updated
Show dashboard widgets for cashflow, income, expenses, or profit, of a stub business.
Initiate linking of bank accounts for a stub business. Once bank accounts are linked users can sync their bank transactions and categorise their transactions using the dashboard widgets in 1.
Access basic information about a stub business. This can be useful for functionality in your product. For example, you can show a call to action to link bank accounts to users of a business with no linked bank accounts.
Add the following code just before the end of the <head>
tag of your web page.
For the latest SDK use:
You can also use specify the latest version, so that you don't receive any breaking changes:
Add the following code just before the end of the <body>
tag of your web page.
For the latest version use:
You can also use specify the latest version, so that you don't receive any breaking changes:
Add a <div>
element to your DOM for each widget that you want to present to your users. Each <div>
must have an ID corresponding to the respective widget that you want it to render.
To make requests via the widget you will need to request an authentication token through your backend and then pass it to the widget.
Once the SDK has loaded, you can initialise the stub widgets from anywhere in your application using the following:
These are the required props to initialise stub. If you do not include them you will see an error in the console.
If renderImmediately
is false
or omitted then you will need to call stub.render()
when you are ready to render the widgets.
You may want to use the stub test environment while you're setting things up, or to integrate with your different environments.
The SDK will default to showing data for the current month, but you can initialise it with a different month and year if you would like to specify that:
stub shows data on the widgets for a specified month and year. It caches much of this data, so updating this is low cost and the widget will render it right away.
You can specify the date range at any point in your application lifecycle using the set()
function.
stub uses the token that you provide it with to authenticate API calls. That means that if the token expires, an API call may fail and your user will see an error message.
To ensure that the stub SDK always has the most up-to-date token, use the set()
function to specify a new one whenever it expires and changes.
that shows a vanilla implementation of the JavaScript SDK. You need to add your App ID, Business ID, and Token to the index.html
file.
Learn how to generate authentication tokens here:
For a full list of initialisation options see the