# Significant Loan Transactions

`POST /lokta-lms/api/v1/loans/{loanId}/transactions`

This API covers the major loan transaction functionality

Example Requests:

loans/1/transactions?command=repayment | Make a Repayment | 
loans/1/transactions?command=merchantIssuedRefund | Merchant Issued Refund | 
loans/1/transactions?command=payoutRefund | Payout Refund | 
loans/1/transactions?command=goodwillCredit | Goodwil Credit | 
loans/1/transactions?command=chargeRefund | Charge Refund | 
loans/1/transactions?command=waiveinterest | Waive Interest | 
loans/1/transactions?command=writeoff | Write-off Loan | 
loans/1/transactions?command=close-rescheduled | Close Rescheduled Loan | 
loans/1/transactions?command=close | Close Loan | 
loans/1/transactions?command=undowriteoff | Undo Loan Write-off | 
loans/1/transactions?command=recoverypayment | Make Recovery Payment | 
loans/1/transactions?command=refundByCash | Make a Refund of an Active Loan by Cash | 
loans/1/transactions?command=foreclosure | Foreclosure of an Active Loan | 
loans/1/transactions?command=creditBalanceRefund | Credit Balance Refund |  
loans/external-id/7dd80a7c-ycba-a446-t378-91eb6f53e854/transactions?command=charge-off | Charge-off Loan |  
loans/1/transactions?command=downPayment | Down Payment |

## Parameters
- `loanId` (path, integer, required): loanId
- `command` (query, string): command

## Request body (application/json)
- `accountNumber` (string)
- `bankNumber` (string)
- `chargeOffReasonId` (integer)
- `checkNumber` (string)
- `classificationId` (integer)
- `dateFormat` (string)
- `dueDate` (string)
- `externalId` (string)
- `frequencyNumber` (integer)
- `frequencyType` (string)
- `interestRefundCalculation` (boolean): Optional. Controls whether Interest Refund transaction should be created for this refund. If not provided, loan product config is used.
- `loanChargeId` (integer)
- `locale` (string)
- `note` (string)
- `numberOfInstallments` (integer)
- `paymentTypeId` (integer)
- `reAgeInterestHandling` (string)
- `reAmortizationInterestHandling` (string)
- `reasonCodeValueId` (integer)
- `receiptNumber` (string)
- `reversalExternalId` (string)
- `routingCode` (string)
- `startDate` (string)
- `transactionAmount` (number)
- `transactionDate` (string)
- `writeoffReasonId` (integer)

## Responses
- `200`: OK

## Response fields
- `changes` (PostLoansLoanIdTransactionsResponseChanges)
- `clientId` (integer)
- `loanId` (integer)
- `officeId` (integer)
- `resourceExternalId` (string)
- `resourceId` (integer)
- `subResourceExternalId` (string)
- `subResourceId` (integer)

## Example request (cURL)
```bash
curl -X POST \
  'http://localhost:8080/lokta-lms/api/v1/loans/{loanId}/transactions' \
  -u '{username}:{password}' \
  -H 'Tenant-Identifier: default' \
  -H 'Content-Type: application/json' \
  -d '{
  "accountNumber": "acc123",
  "bankNumber": "ban123",
  "chargeOffReasonId": 1,
  "checkNumber": "che123",
  "classificationId": 1,
  "dateFormat": "dd MMMM yyyy",
  "dueDate": "28 June 2022",
  "externalId": "3e7791ce-aa10-11ec-b909-0242ac120002",
  "frequencyNumber": 1,
  "frequencyType": "frequencyType"
}'
```

## Example response
```json
{
  "changes": {
    "dateFormat": "dd MMMM yyyy",
    "externalId": "4ff9b1cb988b7",
    "locale": "en_GB",
    "note": "An optional note about why your adjusting or changing the transaction."
  },
  "clientId": 1,
  "loanId": 1,
  "officeId": 1
}
```

Interactive: https://developer.lokta.ai/reference.html#operation/handleCommandsLoanTransaction
