Bulk create loan payments
curl --request POST \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payments": [
{
"external_id": "loan-pmt-001",
"amount": 150000,
"date": "2024-02-15",
"splits": [
{
"split_type": "PRINCIPAL",
"amount": 120000
},
{
"split_type": "INTEREST",
"amount": 30000
}
],
"method": "ACH"
},
{
"external_id": "loan-pmt-002",
"amount": 150000,
"date": "2024-03-15",
"splits": [
{
"split_type": "PRINCIPAL",
"amount": 121000
},
{
"split_type": "INTEREST",
"amount": 29000
}
],
"method": "ACH"
}
]
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk"
payload = { "payments": [
{
"external_id": "loan-pmt-001",
"amount": 150000,
"date": "2024-02-15",
"splits": [
{
"split_type": "PRINCIPAL",
"amount": 120000
},
{
"split_type": "INTEREST",
"amount": 30000
}
],
"method": "ACH"
},
{
"external_id": "loan-pmt-002",
"amount": 150000,
"date": "2024-03-15",
"splits": [
{
"split_type": "PRINCIPAL",
"amount": 121000
},
{
"split_type": "INTEREST",
"amount": 29000
}
],
"method": "ACH"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
payments: [
{
external_id: 'loan-pmt-001',
amount: 150000,
date: '2024-02-15',
splits: [
{split_type: 'PRINCIPAL', amount: 120000},
{split_type: 'INTEREST', amount: 30000}
],
method: 'ACH'
},
{
external_id: 'loan-pmt-002',
amount: 150000,
date: '2024-03-15',
splits: [
{split_type: 'PRINCIPAL', amount: 121000},
{split_type: 'INTEREST', amount: 29000}
],
method: 'ACH'
}
]
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payments' => [
[
'external_id' => 'loan-pmt-001',
'amount' => 150000,
'date' => '2024-02-15',
'splits' => [
[
'split_type' => 'PRINCIPAL',
'amount' => 120000
],
[
'split_type' => 'INTEREST',
'amount' => 30000
]
],
'method' => 'ACH'
],
[
'external_id' => 'loan-pmt-002',
'amount' => 150000,
'date' => '2024-03-15',
'splits' => [
[
'split_type' => 'PRINCIPAL',
'amount' => 121000
],
[
'split_type' => 'INTEREST',
'amount' => 29000
]
],
'method' => 'ACH'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk"
payload := strings.NewReader("{\n \"payments\": [\n {\n \"external_id\": \"loan-pmt-001\",\n \"amount\": 150000,\n \"date\": \"2024-02-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 120000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 30000\n }\n ],\n \"method\": \"ACH\"\n },\n {\n \"external_id\": \"loan-pmt-002\",\n \"amount\": 150000,\n \"date\": \"2024-03-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 121000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 29000\n }\n ],\n \"method\": \"ACH\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payments\": [\n {\n \"external_id\": \"loan-pmt-001\",\n \"amount\": 150000,\n \"date\": \"2024-02-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 120000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 30000\n }\n ],\n \"method\": \"ACH\"\n },\n {\n \"external_id\": \"loan-pmt-002\",\n \"amount\": 150000,\n \"date\": \"2024-03-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 121000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 29000\n }\n ],\n \"method\": \"ACH\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payments\": [\n {\n \"external_id\": \"loan-pmt-001\",\n \"amount\": 150000,\n \"date\": \"2024-02-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 120000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 30000\n }\n ],\n \"method\": \"ACH\"\n },\n {\n \"external_id\": \"loan-pmt-002\",\n \"amount\": 150000,\n \"date\": \"2024-03-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 121000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 29000\n }\n ],\n \"method\": \"ACH\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"loan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"splits": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"split_type": "PRINCIPAL",
"amount": 123,
"account": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"external_id": "<string>"
}
],
"amount": 123,
"date": "2023-12-25",
"defer_posting": true,
"method": "ACH",
"transaction_tags": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "ExampleTagKey",
"value": "ExampleTagValue",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension_display_name": "<string>",
"value_display_name": "<string>",
"archived_at": "2023-11-07T05:31:56Z"
}
],
"external_id": "<string>",
"processor": "<string>",
"payment_clearing_account": {
"type": "Single_Chart_Account",
"id": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "Current Assets",
"account_number": "4000",
"stable_name": {
"type": "StableName",
"stable_name": "CURRENT_ASSETS"
},
"normality": "DEBIT",
"account_type": {
"value": "ASSET",
"display_name": "Asset"
},
"account_subtype": {
"value": "BANK_ACCOUNTS",
"display_name": "Current Assets"
}
},
"archived_at": "2023-11-07T05:31:56Z",
"memo": "<string>",
"metadata": {},
"reference_number": "<string>"
}
]
}Loan Payments
Bulk create loan payments
Creates or updates payments for a loan in a single atomic request. Items are upserted by external_id: payments matching an existing external_id are updated, all others are created. The response returns payments in request order. If any item is invalid, the entire batch is rejected. Items may omit loan_id and loan_external_id; if provided, they must match the loan in the request path.
POST
/
v1
/
businesses
/
{businessId}
/
loans
/
{loanId}
/
payments
/
bulk
Bulk create loan payments
curl --request POST \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payments": [
{
"external_id": "loan-pmt-001",
"amount": 150000,
"date": "2024-02-15",
"splits": [
{
"split_type": "PRINCIPAL",
"amount": 120000
},
{
"split_type": "INTEREST",
"amount": 30000
}
],
"method": "ACH"
},
{
"external_id": "loan-pmt-002",
"amount": 150000,
"date": "2024-03-15",
"splits": [
{
"split_type": "PRINCIPAL",
"amount": 121000
},
{
"split_type": "INTEREST",
"amount": 29000
}
],
"method": "ACH"
}
]
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk"
payload = { "payments": [
{
"external_id": "loan-pmt-001",
"amount": 150000,
"date": "2024-02-15",
"splits": [
{
"split_type": "PRINCIPAL",
"amount": 120000
},
{
"split_type": "INTEREST",
"amount": 30000
}
],
"method": "ACH"
},
{
"external_id": "loan-pmt-002",
"amount": 150000,
"date": "2024-03-15",
"splits": [
{
"split_type": "PRINCIPAL",
"amount": 121000
},
{
"split_type": "INTEREST",
"amount": 29000
}
],
"method": "ACH"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
payments: [
{
external_id: 'loan-pmt-001',
amount: 150000,
date: '2024-02-15',
splits: [
{split_type: 'PRINCIPAL', amount: 120000},
{split_type: 'INTEREST', amount: 30000}
],
method: 'ACH'
},
{
external_id: 'loan-pmt-002',
amount: 150000,
date: '2024-03-15',
splits: [
{split_type: 'PRINCIPAL', amount: 121000},
{split_type: 'INTEREST', amount: 29000}
],
method: 'ACH'
}
]
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payments' => [
[
'external_id' => 'loan-pmt-001',
'amount' => 150000,
'date' => '2024-02-15',
'splits' => [
[
'split_type' => 'PRINCIPAL',
'amount' => 120000
],
[
'split_type' => 'INTEREST',
'amount' => 30000
]
],
'method' => 'ACH'
],
[
'external_id' => 'loan-pmt-002',
'amount' => 150000,
'date' => '2024-03-15',
'splits' => [
[
'split_type' => 'PRINCIPAL',
'amount' => 121000
],
[
'split_type' => 'INTEREST',
'amount' => 29000
]
],
'method' => 'ACH'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk"
payload := strings.NewReader("{\n \"payments\": [\n {\n \"external_id\": \"loan-pmt-001\",\n \"amount\": 150000,\n \"date\": \"2024-02-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 120000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 30000\n }\n ],\n \"method\": \"ACH\"\n },\n {\n \"external_id\": \"loan-pmt-002\",\n \"amount\": 150000,\n \"date\": \"2024-03-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 121000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 29000\n }\n ],\n \"method\": \"ACH\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payments\": [\n {\n \"external_id\": \"loan-pmt-001\",\n \"amount\": 150000,\n \"date\": \"2024-02-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 120000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 30000\n }\n ],\n \"method\": \"ACH\"\n },\n {\n \"external_id\": \"loan-pmt-002\",\n \"amount\": 150000,\n \"date\": \"2024-03-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 121000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 29000\n }\n ],\n \"method\": \"ACH\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/payments/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payments\": [\n {\n \"external_id\": \"loan-pmt-001\",\n \"amount\": 150000,\n \"date\": \"2024-02-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 120000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 30000\n }\n ],\n \"method\": \"ACH\"\n },\n {\n \"external_id\": \"loan-pmt-002\",\n \"amount\": 150000,\n \"date\": \"2024-03-15\",\n \"splits\": [\n {\n \"split_type\": \"PRINCIPAL\",\n \"amount\": 121000\n },\n {\n \"split_type\": \"INTEREST\",\n \"amount\": 29000\n }\n ],\n \"method\": \"ACH\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"loan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"splits": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"split_type": "PRINCIPAL",
"amount": 123,
"account": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"external_id": "<string>"
}
],
"amount": 123,
"date": "2023-12-25",
"defer_posting": true,
"method": "ACH",
"transaction_tags": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "ExampleTagKey",
"value": "ExampleTagValue",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension_display_name": "<string>",
"value_display_name": "<string>",
"archived_at": "2023-11-07T05:31:56Z"
}
],
"external_id": "<string>",
"processor": "<string>",
"payment_clearing_account": {
"type": "Single_Chart_Account",
"id": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "Current Assets",
"account_number": "4000",
"stable_name": {
"type": "StableName",
"stable_name": "CURRENT_ASSETS"
},
"normality": "DEBIT",
"account_type": {
"value": "ASSET",
"display_name": "Asset"
},
"account_subtype": {
"value": "BANK_ACCOUNTS",
"display_name": "Current Assets"
}
},
"archived_at": "2023-11-07T05:31:56Z",
"memo": "<string>",
"metadata": {},
"reference_number": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The UUID of the business.
The UUID of the loan.
Body
application/json
The loan payments to create or update.
The payments to create or update. external_id values must be unique within the request.
Minimum array length:
1Show child attributes
Show child attributes
Response
201 - application/json
Loan payments created or updated successfully.
Show child attributes
Show child attributes
⌘I