# Get Loan payments

## HTTPS Request

<mark style="color:blue;">`GET`</mark> `https://api.lenmo.app/api/v3/loans/{id}/payments/`

This endpoint returns a list of payments related to the requested loan id.

#### Path Parameters

| Name                                 | Type   | Description                            |
| ------------------------------------ | ------ | -------------------------------------- |
| id<mark style="color:red;">\*</mark> | String | Id of the loan related to the payments |

#### Headers

| Name                                          | Type   | Description                                                                 |
| --------------------------------------------- | ------ | --------------------------------------------------------------------------- |
| Accept                                        | String | The content type of the response.                                           |
| X-API-KEY<mark style="color:red;">\*</mark>   | String | The API key that gives the user the authentication to perform this request. |
| X-Timestamp<mark style="color:red;">\*</mark> | String | The timestamp of the request.                                               |
| X-HMAC<mark style="color:red;">\*</mark>      | String | The HMAC generated for the request.                                         |

{% tabs %}
{% tab title="200: OK A list of loan payments" %}

```javascript
[
   {
      "id":301,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-16",
      "payment_status":"paid",
      "payment_status_changed":"2018-10-21T16:15:11.126587Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.239865Z",
      "modified":"2019-03-25T22:37:49.881808Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   },
   {
      "id":302,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-16",
      "payment_status":"paid",
      "payment_status_changed":"2018-10-21T16:15:06.187661Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.251581Z",
      "modified":"2019-03-25T22:37:50.168568Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   },
   {
      "id":309,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-16",
      "payment_status":"paid",
      "payment_status_changed":"2018-10-16T22:17:40.334406Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.334358Z",
      "modified":"2019-03-25T22:37:58.022141Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   },
   {
      "id":310,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-16",
      "payment_status":"Missed Payment",
      "payment_status_changed":"2022-11-29T11:21:08.291956Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.347821Z",
      "modified":"2022-11-29T11:21:48.807060Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   },
   {
      "id":307,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-16",
      "payment_status":"paid",
      "payment_status_changed":"2018-10-21T16:14:39.254253Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.308230Z",
      "modified":"2019-03-25T22:37:56.294834Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   },
   {
      "id":308,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-16",
      "payment_status":"paid",
      "payment_status_changed":"2018-10-16T22:17:40.319419Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.319377Z",
      "modified":"2019-03-25T22:37:56.260690Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   },
   {
      "id":306,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-16",
      "payment_status":"paid",
      "payment_status_changed":"2018-10-21T16:14:45.328520Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.296727Z",
      "modified":"2019-03-25T22:37:54.251698Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   },
   {
      "id":304,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-16",
      "payment_status":"paid",
      "payment_status_changed":"2018-10-21T16:14:56.220972Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.273940Z",
      "modified":"2019-03-25T22:37:53.324683Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   },
   {
      "id":305,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-16",
      "payment_status":"paid",
      "payment_status_changed":"2018-10-21T16:14:50.743028Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.285214Z",
      "modified":"2019-03-25T22:37:52.091427Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   },
   {
      "id":303,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-16",
      "payment_status":"paid",
      "payment_status_changed":"2018-10-21T16:15:01.349985Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.263157Z",
      "modified":"2019-03-25T22:37:52.036709Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   },
   {
      "id":311,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-17",
      "payment_status":"paid",
      "payment_status_changed":"2018-10-16T22:17:40.358601Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.358558Z",
      "modified":"2019-03-25T22:38:00.654317Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   },
   {
      "id":312,
      "loan":43,
      "payment_amount":"91.17",
      "payment_due_date":"2018-10-17",
      "payment_status":"paid",
      "payment_status_changed":"2018-10-16T22:17:40.369242Z",
      "late_payment_fees_amount":null,
      "created":"2018-10-16T22:17:40.369201Z",
      "modified":"2019-03-25T22:37:59.900152Z",
      "is_late_payment":false,
      "processed_on_dwolla":true,
      "delayed_days_count":0,
      "pay_later_fees":null
   }
]
```

{% endtab %}

{% tab title="403: Forbidden Permission Denied" %}

```javascript
{
    "detail": "Authentication credentials were not provided."
}
```

{% endtab %}
{% endtabs %}

#### Sample Request

{% tabs %}
{% tab title="cURL" %}

```clike
curl -X GET "https://api.lenmo.app/api/v3/loans/43/payments/" \
    -H "accept: application/json" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -H "X-Timestamp: REQUEST_TIMESTAMP" \
    -H "X-HMAC: REQUEST_HMAC"
```

{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import requests

# Fetch payments for a given loan id
loan_id = 43
url = f'https://api.lenmo.app/api/v3/loans/{loan_id}/payments/'

headers = {
    'Accept': 'application/json',
    'X-API-KEY': 'YOUR_API_KEY',
    'X-Timestamp': 'REQUEST_TIMESTAMP',
    'X-HMAC': 'REQUEST_HMAC'
}

r = requests.get(url, headers=headers)

print(r.text)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        try {
            int loanId = 43;
            String urlString = "https://api.lenmo.app/api/v3/loans/" + loanId + "/payments/";
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Accept", "application/json");
            connection.setRequestProperty("X-API-KEY", "YOUR_API_KEY");
            connection.setRequestProperty("X-Timestamp", "REQUEST_TIMESTAMP");
            connection.setRequestProperty("X-HMAC", "REQUEST_HMAC");

            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
            String inputLine;
            StringBuilder response = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();

            System.out.println(response.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'uri'

loan_id = 43
url = URI("https://api.lenmo.app/api/v3/loans/#{loan_id}/payments/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept"] = "application/json"
request["X-API-KEY"] = "YOUR_API_KEY"
request["X-Timestamp"] = "REQUEST_TIMESTAMP"
request["X-HMAC"] = "REQUEST_HMAC"

response = http.request(request)
puts response.body

```

{% endtab %}

{% tab title="Node.Js" %}

```javascript
const fetch = require('node-fetch');

const loanId = 43;
const url = `https://api.lenmo.app/api/v3/loans/${loanId}/payments/`;

const headers = {
    "Accept": "application/json",
    "X-API-KEY": "YOUR_API_KEY",
    "X-Timestamp": "REQUEST_TIMESTAMP",
    "X-HMAC": "REQUEST_HMAC",
};

fetch(url, {
    method: 'GET',
    headers: headers
})
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$loanId = 43;
$url = "https://api.lenmo.app/api/v3/loans/$loanId/payments/";

$headers = [
    "Accept: application/json",
    "X-API-KEY: YOUR_API_KEY",
    "X-Timestamp: REQUEST_TIMESTAMP",
    "X-HMAC: REQUEST_HMAC"
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}
{% endtabs %}

#### Response Parameters

| Parameter                   | Type    | Description                                                 |
| --------------------------- | ------- | ----------------------------------------------------------- |
| loan                        | Long    | Id of the loan associated with this payment                 |
| payment\_amount             | Float   | USD amount of the payment                                   |
| payment\_due\_date          | Date    | UTC time for the payment due date.                          |
| payment\_status             | String  | Status of the payment                                       |
| payment\_status\_changed    | Date    | UTC time for last action, took on this payment              |
| late\_payment\_fees\_amount | Float   | If applicable, the late fees of the payment                 |
| created                     | Date    | UTC time of the payment creation in our database            |
| modified                    | Date    | UTC time of the last modification applied to the payment    |
| is\_late\_payment           | Boolean | Payment status to indicate of it was not fulfilled in time. |
| processed\_on\_dwolla       | Boolean | Payment status to indicate if a transfer is initiated       |
| delayed\_days\_count        | Integer | Number of days over the due time.                           |
| pay\_later\_fees            | Float   | Fees for a pay later option.                                |
