API version 1 Prepayments

1. List Prepayments (api1/prepayments)

This method will answer with a collection of iinsight's prepayments that has been modified/created since a provided date. The collection wil be in JSON format.
The results would be paginated, having a maximum of 100 records per page. An empty collection and a status code 200 response, means that there is no records in the specified page.

Server URL HTTP type
UAT https://api-ca-uat.iinsightonline.com/api1/prepayments GET
PRODUCTION https://api-ca.iinsightonline.com/api1/prepayments GET
Authorization
Parameter Value Mandatory
Type Bearer Token Yes
Token The token is generated using the /auth/login method Yes
Query Params
Parameter Value Mandatory
modified_since Date since last update or insert.
Format: YYYY-MM-DDThh:mm:ssZ (date and time in UTC ISO 8601)
Example: 2024-02-29T12:28:01Z
Yes
page The page number of the paginated results. (i.e.: 1) Yes
status The status of the invoice. (i.e.: active / voided) Yes
Response
	  
[ { "prepayment_id": "27", "prepayment_number": "PP27", "date": "2024-04-16T12:00:00Z", "amount": "1222.00", "remaining": "1052.00", "description": "This is a test", "company_id": "99", "case_number": null, "allocations": [ { "payment_id": "580", "payment_number": "VIC10058-P1", "amount": "50.00", "date": "2024-05-25T12:00:00Z" }, { "payment_id": "591", "payment_number": "VIC10080-P1", "amount": "120.00", "date": "2024-06-21T12:00:00Z" } ], "reference_date": "2024-06-19T16:07:54Z" }, { "prepayment_id": "51", "prepayment_number": "PP51", "date": "2024-05-24T12:00:00Z", "amount": "1000.00", "remaining": "900.00", "description": "Testing prepayment of 1000", "company_id": "99", "case_number": null, "allocations": [ { "payment_id": "581", "payment_number": "VIC10058-P2", "amount": "100.00", "date": "2024-05-25T12:00:00Z" } ], "reference_date": "2024-06-19T16:07:54Z" }, { "prepayment_id": "57", "prepayment_number": "PP57", "date": "2024-06-21T12:28:01Z", "amount": "500.00", "remaining": "500.00", "description": "testing from API", "company_id": "99", "case_number": null, "allocations": [], "reference_date": "2024-06-20T17:57:14Z" },
]

2. Create a Prepayment (api1/prepayments/create_prepayment)

This method will allow to create a new prepayment in iinsight.

URL
Server URL HTTP type
UAT https://api-ca-uat.iinsightonline.com/api1/prepayments/create_prepayment POST
PRODUCTION https://api-ca.iinsightonline.com/api1/prepayments/create_prepayment POST
Authorization
Parameter Value Mandatory
Type Bearer Token Yes
Token The token generated using the /auth/login method Yes
Query Params
Parameter Value Mandatory
company_id A valid IInsight Company ID (e.g. 123) Yes
date The date of the prepayment.
Format: YYYY-MM-DDThh:mm:ssZ (date and time in UTC ISO 8601)
Example: 2024-02-29T12:28:01Z
Yes
description A description for the prepayment. Yes
amount The prepayment amount. Positive number. Yes
case_number A valid IInsight Case ID (e.g. 123)
This is a flag to link a prepayment to a specific client case. Then, this prepayment can't be used by other cases.
No
Success Response
{
	"success": true,
	"message": "Prepayment created.",
	"data": {
		"prepayment_id": "65", // IInsight Prepayment ID
		"prepayment_number": "PP65"
	}
}
Failed Response
{
	"success": false,
	"message": "Invalid case number.",
	"data": null
}

3. Allocate a Prepayment (api1/prepayments/allocate)

This method will allow to allocate a Prepayment to an Invoice in iinsight.

URL
Server URL HTTP type
UAT https://api-ca-uat.iinsightonline.com/api1/prepayments/allocate POST
PRODUCTION https://api-ca.iinsightonline.com/api1/prepayments/allocate POST
Authorization
Parameter Value Mandatory
Type Bearer Token Yes
Token The token generated using the /auth/login method Yes
Query Params
Parameter Value Mandatory
prepayment_id A valid IInsight Prepayment ID (e.g. 123) Yes
invoice_id A valid IInsight Invoice ID (e.g. 123) Yes
date The date of the prepayment allocation.
Format: YYYY-MM-DDThh:mm:ssZ (date and time in UTC ISO 8601)
Example: 2024-02-29T12:28:01Z
Yes
amount The allocation amount. Positive number. This amount will be used to pay the invoice. Yes
Success Response
{
	"success": true,
	"message": "Prepayment allocated.",
	"data": {
		"payment_id": "598",
		"payment_number": "VIC10080-P5"
	}
}
Failed Response
{
	"success": false,
	"message": "The amount exceeds the prepayment remaining amount.",
	"data": null
}