We only fund loan using the user's balance now, not balance and bank as done previously. Validation needed for the API endpoint to work:
1. Offer has to be not processed on dwolla before; processed_on_dwolla
attribute have to be False.
2. Offer has to be Accepted
.
3. LoanRequest status has to be Offered
.
4. Borrower has a primary funding resource.
5. Investor's Balance exceeds the total_amount
attribute of the Loan.
{
'message': 'Loan is started to fund, We will notify you just finish.'
}
{
"detail": // reason for not being able to fund the loan.
}
{
"detail": "Authentication credentials were not provided."
}
curl -X POST "https://api.lenmo.app/api/v3/accepted_offers/125944/fund/" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "X-Timestamp: REQUEST_TIMESTAMP" \
-H "X-HMAC: REQUEST_HMAC"
import requests
import json
offer_id = 126315
headers = {
'Accept': 'application/json',
'Content-Type: application/json',
'X-API-KEY': 'YOUR_API_KEY',
'X-Timestamp': 'REQUEST_TIMESTAMP',
'X-HMAC': 'REQUEST_HMAC'
}
body = {}
# Fund
url_fund = f'https://api.lenmo.app/api/v3/accepted_offers/{offer_id}/fund/'
response = requests.post(url_fund, json=body, headers=headers)
print(response.json())
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
try {
int offerId = 126315;
String urlString = "https://api.lenmo.app/api/v3/accepted_offers/" + offerId + "/fund/";
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("X-API-KEY", "YOUR_API_KEY");
connection.setRequestProperty("X-Timestamp", "REQUEST_TIMESTAMP");
connection.setRequestProperty("X-HMAC", "REQUEST_HMAC");
connection.setDoOutput(true);
String jsonInputString = "{}";
try(OutputStream os = connection.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
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();
}
}
}
require 'net/http'
require 'json'
require 'uri'
offer_id = 126315
url = URI("https://api.lenmo.app/api/v3/accepted_offers/#{offer_id}/fund/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request["X-API-KEY"] = "YOUR_API_KEY"
request["X-Timestamp"] = "REQUEST_TIMESTAMP"
request["X-HMAC"] = "REQUEST_HMAC"
request.body = {}.to_json
response = http.request(request)
puts JSON.parse(response.body)
const fetch = require('node-fetch');
const offerId = 126315;
const url = `https://api.lenmo.app/api/v3/accepted_offers/${offerId}/fund/`;
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY",
"X-Timestamp": "REQUEST_TIMESTAMP",
"X-HMAC": "REQUEST_HMAC",
};
const body = {};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(body)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$offerId = 126315;
$url = "https://api.lenmo.app/api/v3/accepted_offers/$offerId/fund/";
$headers = [
"Accept: application/json",
"Content-Type: application/json",
"X-API-KEY: YOUR_API_KEY",
"X-Timestamp: REQUEST_TIMESTAMP",
"X-HMAC: REQUEST_HMAC"
];
$body = json_encode([]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
$json = json_decode($response, true);
print_r($json);
}
curl_close($ch);
?>