Deposit lent funds
Deposit the loan and reflect it in the SMB's accounting platform
Once you receive the configuration information, you are ready to deposit funds into the borrower's bank account. This is known as loan drawdown general lending, and an advance in invoice finance. You will need to:
Create a transfer from the lender's bank account to the borrower's bank account.
Create a bank feed transaction to represent the account transfer in the lender's bank account.
To perform these operations, you will need the following properties:
- Lender's
lendersBankAccount.id
- SMB's
borrowersBankAccount.id
andcurrency
depositDate
- the date the funding was deposited into the borrower's bank accountdepositAmount
- the funding amount or advance provided to the SMB
Create transfer
To record the transfer of money from the lender's bank account to the borrower's bank account:
Use the Get create transfer model endpoint to determine the transfer request parameters.
Call the Create transfer endpoint to perform the transfer of money. Note that you are performing a transfer from
lendersBankAccount.id
toborrowersBankAccount.id
.
- TypeScript
- Python
- C#
- Go
- HTTP
codatLending.loanWriteback.transfers.create({
accountingTransfer: {
date: depositDate,
from: {
accountRef: {
id: lendersBankAccount.id,
},
amount: depositAmount,
currency: borrowersBankAccount.currency,
},
to: {
accountRef: {
id: borrowersBankAccount.id,
},
amount: depositAmount,
currency: borrowersBankAccount.currency,
},
},
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
}).then((res: CreateTransferResponse) => {
if (res.statusCode == 200) {
// handle response
}
});
transfers_create_request = operations.CreateTransferRequest(
accounting_transfer=shared.AccountingTransfer(
date_=deposit_date,
from_=shared.TransferAccount(
account_ref=shared.AccountRef(
id=lenders_bank_account.id,
),
amount=Decimal(deposit_amount),
currency=borrowers_bank_account.currency,
),
to=shared.TransferAccount(
account_ref=shared.AccountRef(
id=borrowers_bank_account_id,
),
amount=Decimal(deposit_amount),
currency=borrowers_bank_account.currency,
),
),
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171',
)
transfers_create_response = codat_lending.loan_writeback.transfers.create(transfers_create_request)
var transfersCreateResponse = await codatLending.LoanWriteback.Transfers.CreateAsync(new CreateTransferRequest() {
AccountingTransfer = new AccountingTransfer() {
Date = depositDate,
From = new TransferAccount() {
AccountRef = new AccountRef() {
Id = lendersBankAccount.Id,
},
Amount = depositAmount,
Currency = borrowersBankAccount.currency,
},
To = new TransferAccount() {
AccountRef = new AccountRef() {
Id = borrowersBankAccountId,
},
Amount = depositAmount,
Currency = borrowersBankAccount.currency,
},
},
CompanyId = "8a210b68-6988-11ed-a1eb-0242ac120002",
ConnectionId = "2e9d2c44-f675-40ba-8049-353bfcb5e171",
});
ctx := context.Background()
transfersCreateResponse, err := codatLending.LoanWriteback.Transfers.Create(ctx, operations.CreateTransferRequest{
AccountingTransfer: &shared.AccountingTransfer{
Date: lending.String(depositDate),
From: &shared.TransferAccount{
AccountRef: &shared.AccountRef{
ID: lending.String(lendersBankAccount.ID),
},
Amount: types.MustNewDecimalFromString(depositAmount),
Currency: lending.String(borrowersBankAccount.currency),
},
To: &shared.TransferAccount{
AccountRef: &shared.AccountRef{
ID: lending.String(borrowersBankAccountID),
},
Amount: types.MustNewDecimalFromString(depositAmount),
Currency: lending.String(borrowersBankAccount.currency),
},
},
CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002",
ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
})
POST https://api.codat.io/companies/{companyId}/connections/{connectionId}/push/transfers
Request body
{
"date": depositDate,
"from": {
"accountRef": {
"id": lendersBankAccount.id,
},
"account": depositAmount,
"currency": borrowersBankAccount.currency,
},
"to": {
"accountRef": {
"id": borrowersBankAccount.id,
},
"account": depositAmount,
"currency": borrowersBankAccount.currency,
}
}
Create bank feed transaction
To record the loan deposit into the lender's bank account:
Get the create bank account transactions model to determine the parameters required for transaction creation.
Create bank account transactions to deposit the amount into the lender's bank account.
We provided example bank transaction creation payloads in the snippets below:
- TypeScript
- Python
- C#
- Go
- HTTP
codatLending.loanWriteback.bankTransactions.create({
accountingCreateBankTransactions: {
accountId: lendersBankAccount.id,
transactions: [
{
id: transactionId, // Unique identifier for this bank transaction
amount: -depositAmount,
date: depositDate,
description: description, // Include a reference to the transfer, the loan and you, the lender
},
],
},
accountId: lendersBankAccount.Id,
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
}).then((res: CreateBankTransactionsResponse) => {
if (res.statusCode == 200) {
// handle response
}
});
bank_transactions_create_request = operations.CreateBankTransactionsRequest(
accounting_create_bank_transactions=shared.AccountingCreateBankTransactions(
account_id=lenders_bank_account.id,
transactions=[
shared.CreateBankAccountTransaction(
id=transaction_id, # Unique identifier for this bank transaction
amount=Decimal(-deposit_amount),
date_=deposit_Date,
description=description, # Include a reference to the transfer, the loan and you, the lender
),
],
),
account_id=lenders_bank_account.id,
company_id='8a210b68-6988-11ed-a1eb-0242ac120002',
connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171',
)
bank_transactions_create_response = codat_lending.loan_writeback.bank_transactions.create(bank_transactions_create_request)
var bankTransactionsCreateResponse = await codatLending.LoanWriteback.BankTransactions.CreateAsync(new CreateBankTransactionsRequest() {
AccountingCreateBankTransactions = new AccountingCreateBankTransactions() {
AccountId = lendersBankAccount.Id,
Transactions = new List<CreateBankAccountTransaction>() {
new CreateBankAccountTransaction() {
Id = transactionId, // Unique identifier for this bank transaction
Amount = -depositAmount,
Date = depositDate,
Description = description, // Include a reference to the transfer, the loan and you, the lender
},
},
},
AccountId = lendersBankAccount.Id,
CompanyId = "8a210b68-6988-11ed-a1eb-0242ac120002",
ConnectionId = "2e9d2c44-f675-40ba-8049-353bfcb5e171"
});
ctx := context.Background()
bankTransactionsCreateRequest, err := codatLending.LoanWriteback.BankTransactions.Create(ctx, operations.CreateBankTransactionsRequest{
AccountingCreateBankTransactions: &shared.AccountingCreateBankTransactions{
AccountID: lending.String(lendersBankAccount.ID),
Transactions: []shared.CreateBankAccountTransaction{
shared.CreateBankAccountTransaction{
ID: lending.String(transactionID), // Unique identifier for this bank transaction
Amount: types.MustNewDecimalFromString(-depositAmount),
Date: lending.String(depositDate),
Description: lending.String(description), // Include a reference to the transfer, the loan and you, the lender
},
},
},
AccountID: lendersBankAccount.ID,
CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002",
ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
})
POST https://api.codat.io/companies/{companyId}/connections/{connectionId}/push/bankAccounts/{accountId}/bankTransactions
Request body
{
"accountId": lendersBankAccount.id,
"transactions": [{
"id": transactionId, // Unique identifier for this bank transaction
"amount": -depositAmount,
"date": depositDate,
"description": description // Include a reference to the transfer, the loan and you, the lender
}]
}
Read next
- Record the repayment of a general loan.
- Record the repayment of an invoice finance loan.