UI configuration and API triggers for iBranch
This page lists the complete API triggers and UI configurations available for iBranch.
List of iBranch API triggers
If you wish to customize the usage of iBranch, you can build your own triggers to open iBranch programmatically with the following routes.
You should have completed the step to Initialize the iBranch first.
Open an invoice or bill in-app
Open an invoice in FundNow (submit a full invoice on frontend)
// Submit FundNow with full invoice payload
lendica.ibranch.submitFundNow(invoicePayload, onSuccess, onExit);
// Invoice payload schema
const invoicePayload = {
"partner_invoice_uuid": "invoice-uuid-123", //required
"total": 10000, //required
"order_date": "yyyy-mm-dd", //required
"due_date": "yyyy-mm-dd", //required
"invoice_number": "INV-001",
"last_updated_datetime": "yyyy-mm-ddT00:00:00Z",
"status": "unpaid",
"payment_terms": "Net 30",
"subtotal": 9500, //required
"tax": 500, //required
"shipping_total": 0,
"settled": true, //required
"company": {
"partner_company_uuid": "company-uuid-123", //required
"company_name": "Your Customer LLC", //required
"first_name": "Jane",
"last_name": "Doe",
"phone_number": "1234567890",
"email": "[email protected]",
"company_address": "123 Main St",
"ein_number": "123456789"
},
"customer": {
"partner_company_uuid": "customer_uuid_123", //required
"company_name": "Customer Inc.", //required
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"phone_number": "0987654321",
"company_address": "456 Customer Ave",
"ein_number": "235236426"
},
"line_items": [
{
"product_id": "product-123",
"product_name": "example_product",
"quantity": 100,
"unit_price": 95,
"unit_of_measure": "pieces",
"line_total": 9500
}
],
"child_invoices": [
{
...
}
]
}
Open a bill in PayLater (submit a full bill on frontend)
// Submit PayLater with full bill payload
lendica.ibranch.submitPayLater(billPayload, onSuccess, onExit);
// Bill payload schema
const billPayload = {
"partner_invoice_uuid": "bill-uuid-123", //required
"total": 10000, //required
"order_date": "yyyy-mm-dd", //required
"due_date": "yyyy-mm-dd", //required
"invoice_number": "INV-001",
"last_updated_datetime": "yyyy-mm-ddT00:00:00Z",
"status": "unpaid",
"payment_terms": "Net 30",
"subtotal": 9500, //required
"tax": 500, //required
"shipping_total": 0,
"settled": true, //required
"company": {
"partner_company_uuid": "company-uuid-123", //required
"company_name": "Your Customer LLC", //required
"first_name": "Jane",
"last_name": "Doe",
"phone_number": "1234567890",
"email": "[email protected]",
"company_address": "123 Main St",
"ein_number": "123456789"
},
"vendor": {
"partner_company_uuid": "vendor_uuid_123", //required
"company_name": "Vendor Inc.", //required
"bank_name": "Vendor Bank", //required
"bank_routing": "987654321", //required
"bank_account": "123456789", //required
"email": "[email protected]",
"phone_number": "0987654321",
"company_address": "456 Vendor Ave"
},
"line_items": [
{
"product_id": "product-123",
"product_name": "example_product",
"quantity": 100,
"unit_price": 95,
"unit_of_measure": "pieces",
"line_total": 9500
}
],
"child_bills": [
{
...
}
]
}
The following 2 routes only works if you have completed the Backend Integration. It will try to get the live invoice data from your backend with the API you provided to us.
Open an invoice in FundNow (with backend data integration only)
// Make sure ibranch is already initialized and rendered
...
// Pass in partner_invoice_uuid and open invoice FundNow
// Pass in the optional invoice total to get marketing offer based on the total amount only
lendica.ibranch.openFundNow(partner_invoice_uuid, total, onSuccess, onExit);
Open a bill in PayLater (with backend data integration only)
// Pass in partner_bill_uuid
// Pass in the optional bill total to get marketing offer based on the total amount only
lendica.ibranch.openPayLater(partner_bill_uuid, total, onSuccess, onExit);
onSuccess and onExit event handlers
onSuccess = (event) => {
// handle deal activation success event
// event.eventName: "DEAL_ACTIVATED"
// event.displayMessage: "Deal activated successfully."
};
onExit = (event) => {
// Handle exit events triggered when deal activation flow is ended by following events
// See below for a list of exit events
};
See last section for list of exit events available.
Triggers to open iBranch
Neutral route to open iBranch programmatically.
// iBranch will display the last page that the user visited
lendica.ibranch.open();
You can also open ibranch on specific pages.
// Available routes
// Account summary with total credit available and deals table
lendica.ibranch.open('wallet');
// Product pages with credit available and invoice table
lendica.ibranch.open('paylater'); // if PayLater is available for the partner
lendica.ibranch.open('fundnow'); // if FundNow is available for the partner
// Upcoming payment schedules and transaction history
lendica.ibranch.open('activity-center');
// Download reports
lendica.ibranch.open('reports');
// Account settings page, with company contact info, and ability to add new bank accounts
lendica.ibranch.open('account');
// Learn more information page
lendica.ibranch.open('learn-more');
Open application
Neutral route to open ibranch on application page. If customer has already been approved, it will redirect to Wallet page.
lendica.apply();
Example open trigger customization
Button or link example* | Method** | When to use |
---|---|---|
![]() ![]() | lendica.ibranch.open() | Provide a link on your top level navigation or as a menu item to introduce the new lending feature. This will open Lendica's landing page on iBranch for general information. |
![]() | lendica.apply() | If you have a marketplace for integrated services, use this method to provide a way to let your customers apply directly. |
![]() | lendica.ibranch.openpaylater(partner_bill_uuid, total, onSuccess, onExit) | Place a PayLater button on each row of the bill table to allow customers to preview offer, apply and get funded. |
![]() | lendica.ibranch.openfundnow(partner_invoice_uuid, total, onSuccess, onExit) | Place a FundNow button on each row of the invoice table to allow customers to preview offer, apply and get funded. |
![]() | lendica.ibranch.open('wallet') | For approved customers with active lines of credit, you can build an account summary with our Backend API, and provide link to open wallet page for account balances and deals. |
*The PayLater and FundNow buttons are available as NPM packages. The other UI components are for illustrative purpose only, you can build them using our Backend API. We may release more pre-built UI components in the future.
If you need help with this document, or need access to the UI elements, please submit the request form here.
Remove iBranch
Remove iBranch from DOM.
lendica.ibranch.destroy();
After removing, you can call render
again to remount iBranch to DOM.
//...after ibranch removed
lendica.ibranch.render();
Subscribe to events
Subscribe to and handle all events. See last section for list of events available.
// Subscribe to specific event type, currently available event types are 'success' and 'exit'
lendica.subscribe("success", (event) => {});
// Subscribe to exit event and handle specific event name
lendica.subscribe('exit', (event)=> {
if (event.eventName === "IBRANCH_CLOSED") {
console.log(e.displayMessage)
// handle iBranch close event
}});
// Subscribe to all events
lendica.subscribe("*", (type, event) => {});
// Unsubscribe
lendica.unsubscribe("success", (event) => {});
// Clear all event listeners
lendica.unsubscribeAll();
Event object schema
{
"eventName": "EVENT_NAME",
"displayMessage": "Detailed message about the event."
}
List of events available
type | eventName | displayMessage | explanation |
---|---|---|---|
success | DEAL_ACTIVATED | Deal activated successfully. | PayLater or FundNow deal was activated successfully. |
exit | IBRANCH_CLOSED | iBranch has been closed. | User closed iBranch. Triggered whenever iBranch open state has changed from true to false. |
APPLICATION_PENDING | Your application is under review. Please check your email for further instructions. | User submitted application and triggered manual review, waiting for approval | |
APPLICATION_REJECTED | Sorry, your application was not approved at this time. | Application was rejected. | |
DEAL_EXCEEDS_LIMIT | Deal amount exceeds available credit. | User application was approved but invoice amount exceeded the available credit limit. | |
PRODUCT_PENDING | Your product activation request is under review. We will get back to you shortly. | User submitted a product activation request, waiting for approval. | |
INTERNAL_SERVER_ERROR | Something went wrong. Please try again later. | Any type of error on backend. |