API – Payment Report

General

LoanPro’s payment report offers detailed information about payments made and which loans the payments were applied towards. Each time a payment report is pulled a query is used to specify what gets pulled based off of either the payment information and/or the loan information. This gives great power and flexibility to pull detailed reports about specific or generalized payment histories.
There are many aspects to a payload, and this article will cover the basics and provide links to resources to learn more about how each element works.

Request URL

The request url is as follows:

https://loanpro.simnang.com/api/public/api/1/Autopal.PaymentReport

All requests sent to this url will be a POST request. Please note that this is different than many other requests to get data where GET requests are used. This is due to the payload sizes becoming potentially large and to keep the URLs readable.

Payload Sections

There are two main sections to the payload:

  • query
  • reportOptions

Each section contains an integral part to the query of the data, and each has its own parameters and format.

Query

The query section is formatted as follows:

"query": {
        "query": {
            <query data>
        }
    }

These queries are modeled after the queries used by Elastic search and are discussed more in depth in the article API Query Objects.

Report Options

The report options section is where field specific to the Payments Report are placed. These fields are outlined below:

  • method – Restrict by payment method. Values can be found in Settings > Loan > Payments > Methods. Values are the titles of payment methods, not the IDs. Use “all” to search for payments using any payment method.
  • type – Restrict by payment type. Values can be found in Settings > Loan > Payments > types. Values are the titles of payment types, not the IDs. Use “all” to search for payments of any type.
  • status – Restrict by payment status. Values are “all” for any status, “new” for newly created payments, and “edited” for edited payments
  • reversereason – deprecated. Defaults to “all”
  • period – The application date period. Defaults to “today”. Values are:
    • today – for payments applying today
    • tw – for payments applying this week
    • td – for the past 30 days
    • mtd – for Month to Date
    • ytd – for Year to Date
    • yesterday – For payments applied Yesterday
    • lw – for last week
    • lm – for last month
    • custom – for a custom date range (specified by dateFrom and dateTo)
    • other – for a different date range (specified by dateFrom and dateTo)
  • dateFrom  – The starting date for the application date range. Formatted with the ISO 8601 Format
  • dateTo  – The ending date for the application date range. Formatted with the ISO 8601 Format
  • changedPeriod – the date period for when the payment was last changed. Same values as the period field.
  • changedDateFrom – The starting date for the payment changed date range. Defaults to “today”. Formatted with the ISO 8601 Format
  • changedDateTo – The starting date for the payment changed date range. Formatted with the ISO 8601 Format
  • sourceCompanies – an array of json objects with each json object containing an integer “id” of a source company id to match against. It matches against source companies with an or operation (Ex. “Do loans have source company 1 or source company 2?”)
  • portfoliosCriteria – deprecated. Use the query object instead (“portfolios” is the field for portfolios, subPortfolios.portfolio__N is the field for the subportfolios where “N” is the ID of the portfolio).
  • splitPayments – Whether or not to restrict to only split payments. Values: “all” – don’t restrict to split payments; “yes” – restrict to only split payments; “no” – exclude all split payments
  • dateEnteredPeriod – The period for when the payment was entered into the system. Same values as the period field.
  • dateEnteredTo – The starting date for the payment entered date range. Defaults to “today”. Formatted with the ISO 8601 Format
  • dateEnteredFrom – The ending date for the payment entered date range. Defaults to “today”. Formatted with the ISO 8601 Format
  • chargeOff – Whether or not to restrict by charge off. Values: “all” – don’t restrict to charge offs; “yes” – restrict to only charge offs; “no” – exclude all charge offs
  • postedBy – Text to match in the description of who posted the payment
  • customFields – This only supports payment custom fields of “select” type.
 Below is an example:
   "reportOptions":
{
 "method": "all",
 "type": "all",
 "status": "all",
 "reversereason": "all",
 "period": "other",
 "dateFrom": "",
 "dateTo": "",
 "changedPeriod": "tw",
 "changedDateFrom": "2016-05-08T00:00:01",
 "changedDateTo": "2016-05-12T23:59:59",
 "sourceCompanies": 
 [
    {
       "id": ""
    }
 ],
 "portfoliosCriteria": "all",
 "splitPayments": "all",
 "dateEnteredPeriod": "other",
 "dateEnteredTo": "",
 "dateEnteredFrom": "",
 "customFields": {
 "25": "1"​
 },
 "chargeOffRecovery": "all",
 "selectedPortfolios": [
 {
 "category": "",
 "portfolio": "",
 "subportfolio": ""
 }
 ]
 }

Putting it all Together

Below is a sample request that pulls all active loans with a loan status id of 2. The payments were applied between 1/1/2016 and 5/12/2016 and last edited in the same time-frame. There are no other restrictions.

{
    "query": {
       "query": {
          "bool": {
             "must":
            [
               {
                "match": 
                {
                   "loanStatusId": "2"
                }
             },
             {
                "match": {
                   "active": "1"
                }
             }
          ]
       }
    }
 },
"reportOptions": {
    "method": "all",
    "type": "all",
    "status": "all",
    "reversereason": "all",
    "period": "ytd",
    "dateFrom": "2016-01-01T00:00:01",
    "dateTo": "2016-05-12T23:59:59",
    "changedPeriod": "ytd",
    "changedDateFrom": "2016-01-01T00:00:01",
    "changedDateTo": "2016-05-12T23:59:59",
    "portfoliosCriteria": "all",
    "splitPayments": "all",
    "dateEnteredPeriod": "other",
    "dateEnteredTo": "",
    "dateEnteredFrom": "",
    "chargeOff": "all",
    "postedBy": "",
    "selectedPortfolios": [
          {
             "category": "",
             "portfolio": "",
             "subportfolio": ""
          }
       ],
       "date": "",
       "customFields": {}
   }
}

Related Articles

Leave A Comment?