Retrieve Company API key
Overview
The /company/token endpoint is crucial for establishing a secure and authenticated connection between Lendica and the company on the partner’s system. This endpoint is responsible for generating and providing a partner_token for a given company, which is subsequently used to authenticate all other requests to the partner API for retrieving company-related data.
When Will Lendica Call This Route?
Lendica will trigger a request to this endpoint following a user's consent to share data within the iBranch. This typically takes place after the user has had the opportunity to review preview offers related to a PayLater bill or a FundNow invoice. The user's consent to share data initiates the process of fetching a partner_token, which is vital for pulling detailed information on invoices or bills from the partner API.
Example Scenario
-
A user is viewing preview offers for a PayLater bill or a FundNow invoice:
lendica.ibranch.openFundNow({ partner_invoice_uuid: "I0001", total: 1000 }); lendica.ibranch.openPayLater({ partner_invoice_uuid: "B0001", total: 1000 }); -
Upon the user's consent to proceed, Lendica will call the
/company/tokenendpoint to retrieve apartner_token. -
Lendica will then use this token to fetch full details of the invoice or bill from the partner API.
Authentication
To secure this endpoint, Lendica should receive a separate API key from the partner to be included in the header of this request.
How to Use This Endpoint
HTTP Method: GET
URL: /company/token
Parameters
company_id: The unique identifier of the company within the partner's system.
Required Fields in Response
The response must be a JSON object containing the following field:
token: Thepartner_tokenrequired for authenticating subsequent requests.
Example Response
{
"token": "abcd1234efgh5678"
}
HTTP Status Codes
200 OK: The request was successful, and thepartner_tokenwas retrieved.401 Unauthorized: The request was not authenticated. Ensure your API key is valid and included in the request header.500 Internal Server Error: An error occurred on the server side. Please contact support.