Introduction
The /transactions
endpoint allows you to perform Create and Read, queries for a Loan Transaction Record by providing relevant information. This endpoint is accessible through either a GET or POST request and requires the use of a valid <api_key>
for authentication purposes. TaskSuite will provide the appropriate key for Giggle Finance. Transactions is a sub-resource of loans, and loans are the top-level resource. There cannot be a transaction without an associated loan.
Authentication
To access this endpoint, you need to include the <api_key>
in the header payload. The <api_key>
serves as an authentication mechanism to ensure only authorized users can manipulate Loan Transaction Records.
Create a Loan Transaction Record
This endpoint is built with an assumption of a reflective procedure. Meaning that the TaskSuite API does not initiate the transactions, but rather reflects the status and result of transactions.
End Point URL
Code Block |
---|
https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions |
Request Method
POST
Create Loan Transaction
This endpoint will handle the creation of a loan transactions. There are six types of transactions that can occur with the TaskSuite API.
Request Body
The request body must be a JSON payload with the following fields
| Field | Description | Data Type/Format | Required |
---|
1 | type | The type of transaction being created. Options: (payout, debit, credit, reversal, settlement, write-off) payout- Initial payout of the loan. debit - Borrower transfers funds to the lender. credit - Lender transfers funds to the borrower. reversal - Reversal of settled transaction. settlement - Loan is settled prematurely. write-off - Remaining owed amount is written off the account.
| String | X |
2 | date | The date of the transaction. | String (YYYY-MM-DD) | X |
3 | amount | The amount of the transaction. | Float | X (Unless transaction is reversed or written off) |
Response
The response will indicate the success or failure of the request to the Loan Transactions endpoint. The details of the response may vary based on the implementation of the API. A typical response will be a JSON object containing a success message or an error message. The response will also include the loan balance.
Payout: Example POST Request
The following example is how one would create a loan transaction record in the TaskSuite system.
Body
Code Block |
---|
|
{
"type": "payout",
"date": "2024-05-22",
"amount": 1000.33
} |
Example (Python)
Code Block |
---|
import requests
import json
url = "https://www.giggle.tasksuite.com/webhookwebhookjson/v1/json/loans/<loan_id:int>/transactions"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <api_key>'
}
payload = json.dumps({
"type": "payout",
"date": "2024-05-22",
"amount": 1000.33,
})
response = requests.request("POST", url, headers=headers, data=payload) |
Example Response (Success)
Code Block |
---|
{
"statusCode": 200,
"status": "OK",
"message": "Transaction of type Payout Successfully Created. The current balance on the account is 1000.33",
"error": false,
"transactionID": 234,
"loanId": 123456,
"loanBalance": 1000.33
} |
Example Response (Failure)
Code Block |
---|
|
{
"statusCode": 400,
"description": "loanId not found",
"name": "Bad Request"
} |
Debit: Example POST Request
The following example is how one would create a loan record in the TaskSuite system.
Body
Code Block |
---|
|
{
"type": "debit",
"date": "2024-05-22",
"amount": 1000.33
} |
Example (Python)
Code Block |
---|
import requests
import json
url = "https://www.giggle.tasksuite.com/webhook/v1/json/loans/<loan_id:int>/transactions"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <api_key>'
}
payload = json.dumps({
"type": "debit",
"date": "2024-05-22",
"amount": 1000.33,
})
response = requests.request("POST", url, headers=headers, data=payload) |
Example Response (Success)
Code Block |
---|
{
"statusCode": 200,
"status": "OK",
"message": "Successful debit of 1000.33. The current balance on the account is 2000.66",
"error": false,
"transactionID": 234,
"loanId": 123456,
"loanBalance": 1000.33
} |
Example Response (Failure)
Code Block |
---|
|
{
"statusCode": 400,
"description": "loanId not found",
"name": "Bad Request"
} |
Credit: Example POST Request
The following example is how one would create a loan record in the TaskSuite system.
Body
Code Block |
---|
|
{
"type": "credit",
"date": "2024-05-22",
"amount": 1000.33
} |
Example (Python)
Code Block |
---|
import requests
import json
url = "https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <api_key>'
}
payload = json.dumps({
"type": "credit",
"date": "2024-05-22",
"amount": 1000.33,
})
response = requests.request("POST", url, headers=headers, data=payload) |
Example Response (Success)
Code Block |
---|
{
"statusCode": 200,
"status": "OK",
"message": "Successful credit of 1000.33. The current balance on the account is 1000.33",
"error": false,
"transactionID": 234,
"loanId": 123456,
"loanBalance": 1000.33
} |
Example Response (Failure)
Code Block |
---|
|
{
"statusCode": 400,
"description": "loanId not found",
"name": "Bad Request"
} |
Reversal: Example POST Request
The following example is how one would create a reversal transaction in the TaskSuite system. Include the transaction ID of the transaction that was reversed in the URL of the HTTP request. Do not include the amount in the body of the payload, the “amount” key value pair will not be considered for reversal type transactions.
Body
Code Block |
---|
|
{
"type": "reversal",
"date": "2024-05-22",
} |
Example URL
Code Block |
---|
https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions/<transaction_id:int> |
Example (Python)
Code Block |
---|
import requests
import json
url = "https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions/<transaction_id:int>"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <api_key>'
}
payload = json.dumps({
"type": "reversal",
"date": "2024-05-22",
})
response = requests.request("POST", url, headers=headers, data=payload) |
Example Response (Success)
Code Block |
---|
{
"statusCode": 200,
"status": "OK",
"message": "Successful reversal of transactionID 234. The current balance on the account is 1000.33",
"error": false,
"transactionID": 234,
"loanId": 123456,
"loanBalance": 1000.33
} |
Example Response (Failure)
Code Block |
---|
|
{
"statusCode": 400,
"description": "loanId not found",
"name": "Bad Request"
} |
Settlement: Example POST Request
The following example is how one would create a settlement transaction in the TaskSuite system. This transaction will mark the loan’s state to ‘settled’.
Body
Code Block |
---|
|
{
"type": "settlement",
"date": "2024-05-22",
"amount": 3253.45
} |
Example (Python)
Code Block |
---|
import requests
import json
url = "https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <api_key>'
}
payload = json.dumps({
"type": "settlement",
"date": "2024-05-22",
"amount": 3253.45,
})
response = requests.request("POST", url, headers=headers, data=payload) |
Example Response (Success)
Code Block |
---|
{
"statusCode": 200,
"status": "OK",
"message": "Successful settlement for the amount 1000.33.",
"error": false,
"transactionID": 234,
"loanId": 123456,
"loanBalance": 0.00
} |
Example Response (Failure)
Code Block |
---|
|
{
"statusCode": 400,
"description": "loanId not found",
"name": "Bad Request"
} |
Write-Off: Example POST Request
The following example is how one would create a write-off transaction in the TaskSuite system. This transaction will mark the loan’s state to ‘written-off’.
Body
Code Block |
---|
|
{
"type": "write-off",
"date": "2024-05-22"
} |
Example (Python)
Code Block |
---|
import requests
import json
url = "https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <api_key>'
}
payload = json.dumps({
"type": "write-off",
"date": "2024-05-22",
})
response = requests.request("POST", url, headers=headers, data=payload) |
Example Response (Success)
Code Block |
---|
{
"statusCode": 200,
"status": "OK",
"message": "Successful write-off for loanId 123456.",
"error": false,
"transactionID": 234,
"loanId": 123456,
"loanBalance": 0.00
} |
Example Response (Failure)
Code Block |
---|
|
{
"statusCode": 400,
"description": "transactionId not found",
"name": "Bad Request"
} |
...
Read Transaction Record(s)
Request Method
GET
Request Body
None
Response
The response will indicate the success or failure of the request to the Loans Transactions endpoint. The details of the response may vary based on the implementation of the API. A typical response will be a JSON object containing a success message or an error message.
Single Transaction Example GET Request
The following is an example of how one would perform a GET request for a loan transaction record in the TaskSuite system. If a specific transaction is required append the transaction ID to the end of the URL route.
End Point URL
Code Block |
---|
https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions/<transaction_id:int> |
Single Transaction Example (Python)
Code Block |
---|
import requests
import json
url = "https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions/<transaction_id:int>"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <api_key>'
}
response = requests.request("GET", url, headers=headers) |
Single Transaction Example Response (Success)
Code Block |
---|
{
"id": 555,
"date": "2024-05-30",
"amount": 100.99,
"type": "credit",
"loanId": 888,
"loanBalance": 888.88
} |
Single Transaction Example Response (Failure)
Code Block |
---|
{
"statusCode": 400,
"description": "TransactionID <ID> not found.",
"name": "Bad Request"
} |
Batch Transaction Example GET Request
The following is an example of how one would perform a GET request for all transaction records associated with a particular loan in the TaskSuite system. Sorting by date, amount, or transactionId is permitted via query parameters.
End Point URLS
Code Block |
---|
https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions
https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions?sort=date&order=desc
https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions?limit=10
... |
Batch Transaction Example (Python)
Code Block |
---|
import requests
import json
url = "https://www.giggle.tasksuite.com/webhook/json/v1/json/loans/<loan_id:int>/transactions"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <api_key>'
}
response = requests.request("GET", url, headers=headers) |
Batch Transaction Example Response (Success)
Code Block |
---|
{
"data": [
{
"id": 1,
"date": "2024-05-30",
"amount":1000.00,
"type": "payout"
},
{
"id": 2,
"date": "2024-06-06",
"amount": 100.00,
"type": "credit"
},
{
"id": 3,
"date": "2024-06-13",
"amount": 100.00,
"type": "credit"
},
{
"id": 4,
"date": "2024-06-15",
"amount": 100.00,
"type": "reversal"
},
],
"metadata": {
"totalCount": 4,
"loanBalance": 900.0,
"loanId": 234,
// "limit": 10
}
} |
Error Handling
In case of errors, the response will contain an appropriate error message with details on what caused the error. Make sure to handle these errors.
Notes
Ensure that the required fields are provided in the request body; otherwise, the API will return an error indicating the missing fields.
The <api_key>
in the headers must be valid and active for the Loan Transaction creation to be successful.
...
Support
If there are any errors or discrepancies with this document or the related API endpoints. Please reach out to support@tasksuite.com and a support engineer with handle your query.