Overview
You can embed Monite’s UI into your web application is to utilize the Drop-in library, which contains pre-built JavaScript web components that can be integrated into almost all types of web apps. To learn how this can be done, follow the steps in this tutorial.Before you begin
Before proceeding with this tutorial, make sure you completed the steps in the Step 1: Get your credentials and Step 2: Implement server side guides.1. Add monite to your app
The fastest way to add Monite to your app is to use NPM or Yarn to install Monite as a package:- npm
- Yarn
2. Create a Drop-in instance
To create a Drop-in instance that contains the UI and configuration for the Drop-in components, add to your application:apiUrl parameter should be set to the base URL for all routes in your application, but you can leave it empty in this tutorial.
Note that the entity-id parameter here should be automatically set to the entity ID you generated in Step 2: Implement server side.
The fetchToken function obtains the user authentication.
(Optional) Configure components
During the Drop-in instance creation, you can set the configuration of the components:Approval Policies
Approval Policies
| Parameter | Values |
|---|---|
| pageSizeOptions | 15, 50, 100 |
Approval Requests
Approval Requests
| Parameter | Values |
|---|---|
| pageSizeOptions | 15, 50, 100 |
Counterparts
Counterparts
| Parameter | Values |
|---|---|
| pageSizeOptions | 15, 50, 100 |
| customerTypes | customer, vendor |
Payables
Payables
| Parameter | Values |
|---|---|
| pageSizeOptions | 15, 50, 100 |
Products
Products
| Parameter | Values |
|---|---|
| pageSizeOptions | 15, 50, 100 |
Receivables
Receivables
| Parameter | Values |
|---|---|
| pageSizeOptions | 15, 50, 100 |
Tags
Tags
User Roles
User Roles
| Parameter | Values |
|---|---|
| pageSizeOptions | 15, 50, 100 |
(Optional) Theming
You can customize the theme of the component as shown:(Optional) Localization
You can customize the locale of the component renderings as shown:3: Set up user authentication
Every entity user of the Monite app should authorize themselves with a mechanism that is used in your web application. When a user is authorized by you, you should also issue an entity user token, as described in the previous Step 2: Implement server side. If you already implemented a backend part that is capable of issuing entity user tokens, then write a function that retrieves this token. However, if you have not implemented the backend part yet but can already generate an entity and entity user token, you can also just send aPOST request to the /auth/token endpoint directly from this script, as shown below:
4: Review the code
Finally, you can compare your resulting code with our template to make sure that everything is correct:(Optional) Events
You can subscribe to events in the Monite system:| Event name | Description |
|---|---|
INVOICE_CREATED | An invoice was created. |
INVOICE_UPDATED | An invoice was updated. |
INVOICE_DELETED | An invoice was deleted. |
INVOICE_SENT | An invoice was sent. |
PAYABLE_APPROVED | A payable was approved. |
PAYABLE_CANCELED | A payable was canceled. |
PAYABLE_DELETED | A payable was deleted. |
PAYABLE_PAY | A payable was paid. |
PAYABLE_REJECTED | A payable was rejected. |
PAYABLE_REOPENED | A payable was reopened. |
PAYABLE_SAVED | A payable was saved. |
PAYABLE_SUBMITTED | A payable was submitted for approval. |
PAYMENTS_ONBOARDING_COMPLETED | The payments onboarding process was completed. |
WORKING_CAPITAL_ONBOARDING_COMPLETED | The working capital (financing) onboarding process was completed. |
Next steps
By completing this quick start, you have learned how to:- Install and set up Monite Drop-in SDK.
- Localize it and change the default appearance.