Marking a Timesheet as paid

Once a timesheet is approved for both the hours and cost related to it, using the API it is possible to complete the process of making a timesheet as paid. Once you have marked the timesheet as paid, it will lock the timesheets from having any editing done so before doing this you should ensure everything is accurate and correct with the timesheet.

There are three steps to making a timesheet as paid:

  • First, retrieve the PaycycleId by performing a query on the specific Timesheet using the Deputy resource API
  • Once you have the PaycycleId you perform a search on the EmployeePayCycle resource api to gain the period Id
  • Finally, execute a POST request to the mark as paid endpoint.

The process is detailed with an example below.

Retrieving the Timesheet to get the related PaycycleId

The first step is to retrieve the PaycycleId from the individual timesheet. This is done using a search on the Deputy resource API with the Timesheet endpoint.

curl  --request POST 'https://{install}.{geo}.deputy.com/api/v1/resource/Timesheet/QUERY'

Sample Payload

{
  "search": {
    "s1": {
      	"data": {timesheetid},
      	"type": "eq",
      	"field": "Id
    }
  }
}

This will return the Timesheet information. As an example we will use a PaycycleId of 89

In the timesheet response this would look like PaycycleId: 89

Using the PaycycleId to retrieve the PeriodId for payroll

The second step is to retrieve the PeriodId from the EmployeePaycycle endpoint. Again performing a search to target the specific record.

curl --request POST 'https://{install}.{geo}.deputy.com/api/v1/resource/EmployeePaycycle/QUERY

Sample Payload

{
  "search": {
    "s1": {
      "data": {PaycycleId},
      "type": "eq",
      "field": "Id"
    }
  }
}

This will return information about the Pay Cycle which is linked to the Timesheet. In the response there will be an element called PeriodId. This is the element you need to be able to mark a Timesheet as paid and you should record it. It is possible for multiple timesheets to have the same PeriodId but you must check every Timesheet for this number.

Lets take an example of 55 so in our example the PayCycleId has returned a payload including PeriodId: 55

Using the PeriodId and TimesheetId(s) to mark Timesheets as paid

The last step of this process is to actually mark the Timesheets as paid. If you have multiple timesheets that have the same PeriodId, you are able to record them all as paid at the same time.

🚧

Reminder

As soon as you mark a Timesheet as paid in Deputy it will no longer be editable. Tread with caution.

curl --request POST 'https://{install}.{geo}.deputy.com/api/v1/payroll/mark/{periodid}/paid

So for our example it would be https://{install}.{geo}.deputy.com/api/v1/payroll/mark/55/paid

Sample Payload

In the payload you need to include the Timesheets that you wish to mark as paid.

❗️

Warning

Every timesheet within the payload must be related to the PeriodId defined in the URL else the entire process will fail and no Timesheets will be marked paid.

{
  "TimesheetIdArray": [4,5,6]
}

The payload of this request has an element called TimesheetIdArray and you can include all the timesheet id numbers which relate to that PeriodId.

Once you send this payload, the timesheets will be marked as paid in Deputy. You can determine this by the PayStaged element being set to true in the response, whereas prior it would have been false on the Timesheet.

Marking a Timesheet as Unpaid

It is also possible to mark Timesheets as unpaid. The process is the same aside from the slightly different url

curl --request POST 'https://{install}.{geo}.deputy.com/api/v1/payroll/mark/{periodid}/unpaid

Include the Timesheets you would like to mark as unpaid in the TimesheetIdArray element of the payload