Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

How to

...

To send an API request to TurnKey Lender, an API key is required. You can generate as many keys as you need with different access permissions in your Back-Office. 

...

How to create your own Front-Office

TurnKey Lender offers the full stack of API methods which can be used by clients to create their own Front-Offices. This can be a website or a mobile application where your borrowers register, apply for loans, track their loan application statuses, sign contracts, pay with a single click, and more.

Let's go through the TurnKey Lender's Front-Office and clarify which API endpoints need to be used to enable this functionality.build this functionality.

API key & Permissions

To send an API request to TurnKey Lender, an API key is required. You can generate as many keys as you need with different access permissions in your Back-Office. For details, read the article How to get access to TurnKey Lender Public API

...

Base URL

The full path to every API endpoint is created as follows: https://{site_domain_name}/PublicApi/{version}/{endpoint_path}.

To simplify reading this article, the base URL (https://{site_domain_name}/PublicApi/{version}) is omitted everywhere below. For example, the endpoint POST https://trial-us.turnkey-lender.com/PublicApi/v7-8/User/Login is called POST /User/Login.

User token

Once a customer creates their personal account or authorizes on the platform, their unique AuthToken  is generated. This token is required as tkLender_UserAuthToken almost for all endpoints below.  

Welcome page

...

To create this web page, the following methods are used:

  • GET /Customer/CreditProducts
    The info you get through this method lets you show the list of available credit products and bounds for the Loan amount and Term sliders. 

  • GET /Customer/States
    If the 'States management' feature is enabled on the Back-Office, this method shows the list of states/provinces. 

    This feature applies to the United States edition and the Canada edition. 

  • POST /Customer/Loans/Calculate
    Calculates the corresponding loan offer terms:  

  • GET /Customer/PromoCode/Check
    If a customer provides a promo code, it should is checked and verified on the server side.

Once a customer submits selecting selected loan termterms, these data should be saved in some way because these while these data points are needed on the next step to create a loan application.  On TurnKey Lender Front-Office, for example, the next next page (Create an account page ) opens, and all specified parameters are sent in the URL .  (for details, see Front site integration).

Create an account page

...

Once a customer submits their login (email format is mandatory) and password, the following methods are used:

...

  • POST ​/Customer​/Register
    A new customer is registered in the system tkLender_UserAuthToken is generated for their personal account. This token is required for all the endpoints used later on. 
    A new account is created with the status 'Registration incomplete'.

  • POST /Customer/Loans/Create
    A new loan is created for the authorized customer and the Public Loan ID is sent in response. A new loan is created with the 'Pre-Origination' status because Customer Details aren't filled out yet. Until they are, this loan is not visible on the Origination workplace of the Back-Office. 

...

We recommend that you add a captcha to your web page(s) that where customers create new user accounts and loans.

Application form

...

To save the provided customer's details, the following next method can should be used:

  • POST /Customer​/Details
    The list of the Application form fields depends on the project, that's why the Customer Details structure should be discussed with the TurnKey Lender development team.  Feel free to find 'Customer details' object description for pure TurnKey Lender BOX editions  here: API. Customer Details structures.

    It is possible to divide and send values in several batches, in case the Application form is split into multiple steps. 
    To avoid losing data, all previously sent data has to be resent with every new POST request. 

    To finalize filling in the Application Form, the parameter 'DetailsFilled' value should be set to 'true'.  By doing this,   As a result, the status of the customer's account status is changed to 'Active'.

    (warning) There is no validation of the customer's data on the server!
    The validation has to be implemented on the front-end according to the application form specification.Feel free to find 'Application form' specifications for pure TurnKey Lender BOX editions  here - Customer Details specifications

To add a document to the customer's details, the following steps need to be doneIf a customer wants to upload their Photo (as an avatar), the following methods should be used:

  • POST ​/Files​/Upload
    This method uploads a new file to the TurnKey Lender server for the authorized customer. As a result, DocumentId is generated on the server and returned. 

  • In the PUT POST /Customer​/Details body, the 'Docs' (array) section is in the Customer Details object.  
    To add a new document to the customer's profile, it is necessary to only send the DocumentId of this file.  

  • GET /Customer​/Details
    This method returns all the info from the customer's authorized profile.
    For every linked document, an additional parameter, ID, is returned. This identifier defines the link between a document and the customer's profile. 
    It is required to send both Id and DocumentId with every following PUT /Customer​/Details request:

...


  • The received DocumentId should be sent as a value for the 'PhotoId’ parameter.

Personal & Loan Documents

To support Personal & Loan documents management, the following endpoints need to be done:

  • GET /UserDocuments
    This endpoint is used to get all documents that are already linked to the customer’s profile or to one of their loan.
    This method is also useful to get the actual structure of document groups and their settings. Every group has its unique ‘Id’ that is required later to link any new file to the customer’s profile or loan with the endpoint PUT /UserDocuments.

  • POST ​/Files​/Upload
    This method should be used every time when a new file needs to be uploaded to the database. As a result, ‘DocumentId’ is generated and returned. 

  • PUT /UserDocuments
    This method is used to link a previously uploaded file to a customer’s profile or to a customer’s loan.

  • GET /Files/GetInfo
    Using this method, it is possible to get all details of any previously uploaded file by its ‘DocumentId’.

  • GET /Files/Download
    This method lets download any file to customer’s device or create a preview.

  • DELETE /UserDocuments
    To unlink a document from the customer's profile or loan, it is enough

...

  • to

...

  • apply the

...

  • needed '

...

  • DocumentId' to this endpoint. The file is not erased from the database, so it is possible to use the same 'DocumentId' to link this file again to another document group or loan.

Verify bank account

...

This step is available if the 'Bank account verification' integration (Paid, Flinks, etc.) is enabled on the Back-Office and all credentials are correctly set there. 

...

The diagram below shows how to use the API methods and this algorithm works for any built-in provider (see Integrations By Country):

  • GET /PaymentOptions/BankVerification/Settings
    Get settings to open iframe for the integrated bank verification provider.

  • POST /PaymentOptions/BankVerification/SaveData
    Save all data received from Bank verification service (iframe) in TurnKey Lender Database

  • GET /PaymentOptions/BankVerification/IsDataProcessed
    Check if bank account verification is passed successfully and all data is received by TurnKey Lender.

...

Customer's Dashboard

Personal details

...

To show display and manage customer's details, two methods can be used:

...

The following endpoints are needed to manage customer's Personal documents:

  • POST /Files/Upload

  • GET ​/Files​/GetInfo​/{documentId}

  • GET ​/Files​/Download

  • GET /UserDocuments

  • PUT /UserDocuments

  • DELETE /UserDocuments

The authorized customer can change their password with the next method:

...

The list of all customer's loans, which are not sent to Archive, can be retrieved with the following next method: 

  • GET /Customer/Loans
    The received info is enough to display all general info about the loan, the actual loan schedule, the list of all repayment transactions, etc. 

...

  • POST ​/PaymentOptions​/SubmitRepayment​/{loanId}
    Submits repayment for a given loan. The funds will be automatically charged from the customer's card or bank account.

  • GET /PaymentOptions/RepaymentAmounts/{loanId}
    Returns possible repayment amounts for a given loan

New loan

...

Creating a repeated loan (another loan taken out by the same customer) is much easier than creating the first one. Here are the required steps:

...