Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Xero API, create payslips for PayRun in "DRAFT" status

Started by Valentin Nikolaev -   in API Endpoints

Hello, community

I would be grateful if you could help me with Payslips creation via Xero Api? I didn't find any answers to my questions on GitHub, Dev community and official documentation..

If we create PayRun in "DRAFT" status, then PaySlip won't be created:
--------------------------------------------------------------------------
Xero official documentation:
https://developer.xero.com/documentation/api/payrollau/integration-guide/#pay-templates

Any items that are available on the Pay Template will automatically be pre-filled on the PaySlip (including the information from the approved timesheets within the Pay Run window) for scheduled Pay Runs. If there is no Pay Template configured for the employee or if the information needs to be adjusted from the default Pay Template, then Payslips will need to be added/edited using the Payslips endpoint. These modifications must be done while the Pay Run is in DRAFT status.

Note: Unscheduled Pay Runs don’t generate Payslips, so developers will need to do this separately.
-------------------------------------------------------------------------------

In our case Payslips aren't created for a "DRAFT" Pay Runs. So there should be a "CREATE" Api endpoint for payslip as might be assumed. But there is no API endpoint to CREATE new PaySlip for "DRAFT" Pay Run. There's a discrepancy between the Api and the Integration guide.

Realy, no endpoint to create Payslip from API side..

I've checked OpenAPI specification e.t.c and nothing found there either.

Also I've found the same question on Xero developer's forum without an answer https://community.xero.com/developer/discussion/130258174/

So the question is how to create Payslip from the Xero API side?
Hi Valentin

Can you confirm you are using the Australian payroll features, the APIs for payroll do vary between regions.

For Australia, the process is described here https://developer.xero.com/documentation/api/payrollau/overview, you would create a scheduled Pay Run by supplying the PayrollCalendarID, this will create a draft Pay Run for the next period. Payslips are created based on the employees that are included on the calendar in question.

You can try this in the demo company by making the following calls:
GET https://api.xero.com/payroll.xro/1.0/PayrollCalendars - to retrieve the PayrollCalendarID
POST https://api.xero.com/payroll.xro/1.0/PayRuns - to create the draft pay run
GET https://api.xero.com/payroll.xro/1.0/PayRuns/14c78a08-42fa-42f8-bb65-cef597cb54fc to view the newly created pay run and to find the Payslip ID for the pay slips generated.

If no payslips are being generated, this might be if there are no employees assigned to the Payroll Calendar in question, or if the pay run was unscheduled.
 

Robin Blackstone (Community Manager)  

AU

Hello, Robin, thanks for a quick response. This Pay Run is "Unscheduled". It means - manually created "Pay Run" via API. For such PayRun Payslips have been not created. And I need to create them for "Unscheduled" payruns. According to documentation:

"Unscheduled Pay Runs don’t generate Payslips, so developers will need to do this separately."

I can't do it as a developer because API doesn't provide CREATE method for PaySlip :(
 

Valentin Nikolaev