Xero Payroll NZ

PayrollNz

approveTimesheet

Approves a timesheet


/Timesheets/{TimesheetID}/Approve

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$timesheetID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
$idempotencyKey = "KEY_VALUE";

try {
  $result = $apiInstance->approveTimesheet($xeroTenantId, $timesheetID, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->approveTimesheet: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.timesheets Grant read-write access to payroll timesheets

Parameters

Path parameters
Name Description
TimesheetID*
UUID (uuid)
Identifier for the timesheet
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.

createDeduction

Creates a new deduction for a specific employee


/Deductions

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$idempotencyKey = "KEY_VALUE";

$deduction = new XeroAPI\XeroPHP\Models\PayrollNz\Deduction;
$deduction->setDeductionName('Deduction test');
$deduction->setDeductionCategory(XeroAPI\XeroPHP\Models\PayrollNz\Deduction\DEDUCTION_CATEGORY_NZ_OTHER);
$deduction->setLiabilityAccountId('00000000-0000-0000-0000-000000000000');

try {
  $result = $apiInstance->createDeduction($xeroTenantId, $deduction, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createDeduction: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
deduction *
Deduction
Required

createEarningsRate

Creates a new earnings rate


/EarningsRates

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$idempotencyKey = "KEY_VALUE";

$earningsRate = new XeroAPI\XeroPHP\Models\PayrollNz\EarningsRate;
$earningsRate->setEarningsType(XeroAPI\XeroPHP\Models\PayrollNz\EarningsRate\EarningsTypeEnum.RegularEarnings);
$earningsRate->setRateType(XeroAPI\XeroPHP\Models\PayrollNz\EarningsRate\RateTypeEnum.RatePerUnit);
$earningsRate->setExpenseAccountID('00000000-0000-0000-0000-000000000000');

try {
  $result = $apiInstance->createEarningsRate($xeroTenantId, $earningsRate, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createEarningsRate: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
earningsRate *
EarningsRate
Required

createEmployee

Creates an employees


/Employees

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$idempotencyKey = "KEY_VALUE";
$dateOfBirth = new DateTime('2000-10-28');

$address = new XeroAPI\XeroPHP\Models\PayrollNz\Address;
$address->setAddressLine1('123 Test st');
$address->setCity('Rangiora');
$address->setPostCode('7400');
$address->setCountryName('NEW ZEALAND');

$employee = new XeroAPI\XeroPHP\Models\PayrollNz\Employee;
$employee->setFirstName('Adam');
$employee->setLastName('Adamson');
$employee->setDateOfBirth($dateOfBirth);
$employee->setAddress($address);

try {
  $result = $apiInstance->createEmployee($xeroTenantId, $employee, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createEmployee: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
employee *
Employee
Required

createEmployeeEarningsTemplate

Creates earnings template records for an employee


/Employees/{EmployeeID}/PayTemplates/Earnings

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";

$earningsTemplate = new XeroAPI\XeroPHP\Models\PayrollNz\EarningsTemplate;
$earningsTemplate->setPayTemplateEarningID('00000000-0000-0000-0000-000000000000');
$earningsTemplate->setRatePerUnit(14.25);
$earningsTemplate->setNumberOfUnits(35.5);
$earningsTemplate->setFixedAmount(50);
$earningsTemplate->setEarningsRateID('00000000-0000-0000-0000-000000000000');
$earningsTemplate->setName('Overtime Hours');
$earningsTemplates = [];
array_push($earningsTemplates, $earningsTemplate);

try {
  $result = $apiInstance->createEmployeeEarningsTemplate($xeroTenantId, $employeeID, $earningsTemplate, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createEmployeeEarningsTemplate: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
earningsTemplate *
EarningsTemplate
Required

createEmployeeLeave

Creates leave records for a specific employee


/Employees/{EmployeeID}/Leave

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";
$startDate = new DateTime('2020-10-28');
$endDate = new DateTime('2020-10-30');

$employeeLeave = new XeroAPI\XeroPHP\Models\PayrollNz\EmployeeLeave;
$employeeLeave->setLeaveTypeID('00000000-0000-0000-0000-000000000000');
$employeeLeave->setStartDate($startDate);
$employeeLeave->setEndDate($endDate);
$employeeLeave->setNumberOfUnits($numberOfUnits);
$employeeLeave->setNumberOfUnitsTaken($numberOfUnitsTaken);

try {
  $result = $apiInstance->createEmployeeLeave($xeroTenantId, $employeeID, $employeeLeave, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createEmployeeLeave: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
employeeLeave *
EmployeeLeave
Required

createEmployeeLeaveSetup

Creates a leave set-up for a specific employee. This is required before viewing, configuring and requesting leave for an employee


/Employees/{EmployeeID}/LeaveSetup

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";

$employeeLeaveSetup = new XeroAPI\XeroPHP\Models\PayrollNz\EmployeeLeaveSetup;
$employeeLeaveSetup->setIncludeHolidayPay(false);
$employeeLeaveSetup->setHolidayPayOpeningBalance(10.5);
$employeeLeaveSetup->setAnnualLeaveOpeningBalance(25.89);
$employeeLeaveSetup->setSickLeaveHoursToAccrueAnnually(100.0);
$employeeLeaveSetup->setSickLeaveMaximumHoursToAccrue(200.0);
$employeeLeaveSetup->setSickLeaveOpeningBalance(10.5);
$employeeLeaveSetup->setSickLeaveToAccrueAnnually($100.0);
$employeeLeaveSetup->setSickLeaveMaximumToAccrue($200.0);
$employeeLeaveSetup->setSickLeaveScheduleOfAccrual($'');
$employeeLeaveSetup->setSickLeaveAnniversaryDate($);
$employeeLeaveSetup->setAnnualLeaveAnniversaryDate($);

try {
  $result = $apiInstance->createEmployeeLeaveSetup($xeroTenantId, $employeeID, $employeeLeaveSetup, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createEmployeeLeaveSetup: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
employeeLeaveSetup *
EmployeeLeaveSetup
Required

createEmployeeLeaveType

Creates leave type records for a specific employee


/Employees/{EmployeeID}/LeaveTypes

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";

$employeeLeaveType = new XeroAPI\XeroPHP\Models\PayrollNz\EmployeeLeaveType;
$employeeLeaveType->setLeaveTypeID('00000000-0000-0000-0000-000000000000');
$employeeLeaveType->setScheduleOfAccrual(XeroAPI\XeroPHP\Models\PayrollNz\EmployeeLeaveType\ScheduleOfAccrualEnum.PercentageOfGrossEarnings);
$employeeLeaveType->setOpeningBalance(5.25);
$employeeLeaveType->setScheduleOfAccrualDate($);

try {
  $result = $apiInstance->createEmployeeLeaveType($xeroTenantId, $employeeID, $employeeLeaveType, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createEmployeeLeaveType: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
employeeLeaveType *
EmployeeLeaveType
Required

createEmployeeOpeningBalances

Creates opening balances for a specific employee


/Employees/{EmployeeID}/OpeningBalances

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";
$periodEndDate = new DateTime('2020-10-30');

$employeeOpeningBalance = new XeroAPI\XeroPHP\Models\PayrollNz\EmployeeOpeningBalance;
$employeeOpeningBalance->setPeriodEndDate($periodEndDate);
$employeeOpeningBalance->setDaysPaid(5);
$employeeOpeningBalance->setUnpaidWeeks(0);
$employeeOpeningBalance->setGrossEarnings(1730.77);
$employeeOpeningBalances = [];
array_push($employeeOpeningBalances, $employeeOpeningBalance);

try {
  $result = $apiInstance->createEmployeeOpeningBalances($xeroTenantId, $employeeID, $employeeOpeningBalance, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createEmployeeOpeningBalances: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
employeeOpeningBalance *
array[EmployeeOpeningBalance]
Required

createEmployeePaymentMethod

Creates a payment method for an employee


/Employees/{EmployeeID}/PaymentMethods

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";

$bankAccount = new XeroAPI\XeroPHP\Models\PayrollNz\BankAccount;
$bankAccount->setAccountName('Charlotte Danes');
$bankAccount->setAccountNumber(123456);
$bankAccount->setSortCode('123411');
$bankAccounts = [];
array_push($bankAccounts, $bankAccount);

$paymentMethod = new XeroAPI\XeroPHP\Models\PayrollNz\PaymentMethod;
$paymentMethod->setBankAccounts($bankAccounts);

try {
  $result = $apiInstance->createEmployeePaymentMethod($xeroTenantId, $employeeID, $paymentMethod, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createEmployeePaymentMethod: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
paymentMethod *
PaymentMethod
Required

createEmployeeSalaryAndWage

Creates an employee salary and wage record


/Employees/{EmployeeID}/SalaryAndWages

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";

$salaryAndWage = new XeroAPI\XeroPHP\Models\PayrollNz\SalaryAndWage;
$salaryAndWage->setEarningsRateID('00000000-0000-0000-0000-000000000000');
$salaryAndWage->setNumberOfUnitsPerDay(0);
$salaryAndWage->setDaysPerWeek(0);
$salaryAndWage->setPaymentType(XeroAPI\XeroPHP\Models\PayrollNz\SalaryAndWage\PaymentTypeEnum.HOURLY);

try {
  $result = $apiInstance->createEmployeeSalaryAndWage($xeroTenantId, $employeeID, $salaryAndWage, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createEmployeeSalaryAndWage: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
salaryAndWage *
SalaryAndWage
Required

createEmployeeWorkingPattern

Creates an employee working pattern


/Employees/{EmployeeID}/Working-Patterns

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";
$effectiveFrom = new DateTime('2020-10-28');

$workingWeek = new XeroAPI\XeroPHP\Models\PayrollNz\WorkingWeek;
$workingWeek->setmonday(8);
$workingWeek->settuesday(8);
$workingWeek->setwednesday(8);
$workingWeek->setthursday(8);
$workingWeek->setfriday(8);
$workingWeek->setsaturday(0);
$workingWeek->setsunday(0);

try {
  $result = $apiInstance->createEmployeeWorkingPattern($xeroTenantId, $employeeID, $employeeWorkingPatternWithWorkingWeeksRequest, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createEmployeeWorkingPattern: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
employeeWorkingPatternWithWorkingWeeksRequest *
EmployeeWorkingPatternWithWorkingWeeksRequest
Required

createEmployment

Creates an employment detail for a specific employee


/Employees/{EmployeeID}/Employment

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";
$startDate = new DateTime('2020-10-28');

$employment = new XeroAPI\XeroPHP\Models\PayrollNz\Employment;
$employment->setPayrollCalendarID('00000000-0000-0000-0000-000000000000');
$employment->setStartDate($startDate);
$employment->setEngagementType($'');
$employment->setFixedTermEndDate($);

try {
  $result = $apiInstance->createEmployment($xeroTenantId, $employeeID, $employment, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createEmployment: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
employment *
Employment
Required

createLeaveType

Creates a new leave type


/LeaveTypes

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$idempotencyKey = "KEY_VALUE";

$leaveType = new XeroAPI\XeroPHP\Models\PayrollNz\LeaveType;
$leaveType->setName('LeaveType');
$leaveType->setIsPaidLeave(true);
$leaveType->setShowOnPayslip(true);

try {
  $result = $apiInstance->createLeaveType($xeroTenantId, $leaveType, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createLeaveType: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
leaveType *
LeaveType
Required

createMultipleEmployeeEarningsTemplate

Creates multiple employee earnings template records for a specific employee


/Employees/{EmployeeID}/PayTemplateEarnings

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";

$earningsTemplate = new XeroAPI\XeroPHP\Models\PayrollNz\EarningsTemplate;
$earningsTemplate->setPayTemplateEarningID('00000000-0000-0000-0000-000000000000');
$earningsTemplate->setRatePerUnit(14.25);
$earningsTemplate->setNumberOfUnits(35.5);
$earningsTemplate->setFixedAmount(50);
$earningsTemplate->setEarningsRateID('00000000-0000-0000-0000-000000000000');
$earningsTemplate->setName('Overtime Hours');
$earningsTemplates = [];
array_push($earningsTemplates, $earningsTemplate);

try {
  $result = $apiInstance->createMultipleEmployeeEarningsTemplate($xeroTenantId, $employeeID, $earningsTemplate, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createMultipleEmployeeEarningsTemplate: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
earningsTemplate *
array[EarningsTemplate]
Required

createPayRun

Creates a pay run


/PayRuns

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$idempotencyKey = "KEY_VALUE";

$payRun = new XeroAPI\XeroPHP\Models\PayrollNz\PayRun;
$payRun->setPayRunType(XeroAPI\XeroPHP\Models\PayrollNz\PayRun\PayRunTypeEnum.SCHEDULED);
$payRun->setPayrollCalendarID('00000000-0000-0000-0000-000000000000');

try {
  $result = $apiInstance->createPayRun($xeroTenantId, $payRun, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createPayRun: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.payruns Grant read-write access to payroll payruns

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
payRun *
PayRun
Required

createPayRunCalendar

Creates a new payrun calendar


/PayRunCalendars

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$idempotencyKey = "KEY_VALUE";
$startDate = new DateTime('2020-10-28');
$paymentDate = new DateTime('2020-10-30');

$payRunCalendar = new XeroAPI\XeroPHP\Models\PayrollNz\PayRunCalendar;
$payRunCalendar->setCalendarType(XeroAPI\XeroPHP\Models\PayrollNz\CalendarType.WEEKLY);
$payRunCalendar->setPeriodStartDate($startDate);
$payRunCalendar->setPaymentDate($paymentDate);

try {
  $result = $apiInstance->createPayRunCalendar($xeroTenantId, $payRunCalendar, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createPayRunCalendar: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
payRunCalendar *
PayRunCalendar
Required

createReimbursement

Creates a new reimbursement


/Reimbursements

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$idempotencyKey = "KEY_VALUE";

$reimbursement = new XeroAPI\XeroPHP\Models\PayrollNz\Reimbursement;
$reimbursement->setName('Test Reimbursement');
$reimbursement->setAccountID('00000000-0000-0000-0000-000000000000');
$reimbursement->setCalculationType(XeroAPI\XeroPHP\Models\PayrollNz\Reimbursement\CalculationTypeEnum.FIXEDAMOUNT);
$reimbursement->setReimbursementCategory(XeroAPI\XeroPHP\Models\PayrollNz\Reimbursement\ReimbursementCategoryEnum.GST);

try {
  $result = $apiInstance->createReimbursement($xeroTenantId, $reimbursement, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createReimbursement: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
reimbursement *
Reimbursement
Required

createSuperannuation

Creates a new superannuation


/Superannuations

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$idempotencyKey = "KEY_VALUE";

$benefit = new XeroAPI\XeroPHP\Models\PayrollNz\Benefit;
$benefit->setCategory(XeroAPI\XeroPHP\Models\PayrollNz\Benefit\CategoryEnum.ComplyingFund);
$benefit->setCalculationTypeNZ(XeroAPI\XeroPHP\Models\PayrollNz\Benefit\CalculationTypeNZ.PercentageOfTaxableEarnings);
$benefit->setLiabilityAccountId('00000000-0000-0000-0000-000000000000');
$benefit->setExpenseAccountId('00000000-0000-0000-0000-000000000000');
$benefit->setPercentage(3);
$benefit->setStandardAmount(100);

try {
  $result = $apiInstance->createSuperannuation($xeroTenantId, $benefit, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createSuperannuation: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
benefit *
Benefit
Required

createTimesheet

Creates a new timesheet


/Timesheets

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$idempotencyKey = "KEY_VALUE";
$startDate = new DateTime('2020-10-28');
$endDate = new DateTime('2020-10-30');

$timesheet = new XeroAPI\XeroPHP\Models\PayrollNz\Timesheet;
$->setPayrollCalendarID('00000000-0000-0000-0000-000000000000');
$->setEmployeeID('00000000-0000-0000-0000-000000000000');
$timesheet->setStartDate($startDate);
$timesheet->setEndDate($endDate);

try {
  $result = $apiInstance->createTimesheet($xeroTenantId, $timesheet, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createTimesheet: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.timesheets Grant read-write access to payroll timesheets

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
timesheet *
Timesheet
Required

createTimesheetLine

Create a new timesheet line for a specific time sheet


/Timesheets/{TimesheetID}/Lines

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$timesheetID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
$idempotencyKey = "KEY_VALUE";
$date = new DateTime('2020-10-28');

$timesheetLine = new XeroAPI\XeroPHP\Models\PayrollNz\TimesheetLine;
$timesheetLine->setTimesheetLineID('00000000-0000-0000-0000-000000000000');
$timesheetLine->setDate($date);
$timesheetLine->setEarningsRateID('00000000-0000-0000-0000-000000000000');
$timesheetLine->setTrackingItemID('00000000-0000-0000-0000-000000000000');
$timesheetLine->setNumberOfUnits(6);

try {
  $result = $apiInstance->createTimesheetLine($xeroTenantId, $timesheetID, $timesheetLine, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->createTimesheetLine: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.timesheets Grant read-write access to payroll timesheets

Parameters

Path parameters
Name Description
TimesheetID*
UUID (uuid)
Identifier for the timesheet
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
timesheetLine *
TimesheetLine
Required

deleteEmployeeEarningsTemplate

Deletes an employee's earnings template record


/Employees/{EmployeeID}/PayTemplates/Earnings/{PayTemplateEarningID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$payTemplateEarningID = "3fa85f64-5717-4562-b3fc-2c963f66afa6";

try {
  $result = $apiInstance->deleteEmployeeEarningsTemplate($xeroTenantId, $employeeID, $payTemplateEarningID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->deleteEmployeeEarningsTemplate: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
PayTemplateEarningID*
UUID (uuid)
Id for single pay template earnings object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

deleteEmployeeLeave

Deletes a leave record for a specific employee


/Employees/{EmployeeID}/Leave/{LeaveID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$leaveID = "c4be24e5-e840-4c92-9eaa-2d86cd596314";

try {
  $result = $apiInstance->deleteEmployeeLeave($xeroTenantId, $employeeID, $leaveID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->deleteEmployeeLeave: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
LeaveID*
UUID (uuid)
Leave id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

deleteEmployeeSalaryAndWage

Deletes an employee's salary and wages record


/Employees/{EmployeeID}/SalaryAndWages/{SalaryAndWagesID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$salaryAndWagesID = "3fa85f64-5717-4562-b3fc-2c963f66afa6";

try {
  $result = $apiInstance->deleteEmployeeSalaryAndWage($xeroTenantId, $employeeID, $salaryAndWagesID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->deleteEmployeeSalaryAndWage: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
SalaryAndWagesID*
UUID (uuid)
Id for single salary and wages object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

deleteEmployeeWorkingPattern

deletes employee's working patterns


/Employees/{EmployeeID}/Working-Patterns/{EmployeeWorkingPatternID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$employeeWorkingPatternID = "4ff1e5cc-9835-40d5-bb18-09f3b118db9c";

try {
  $result = $apiInstance->deleteEmployeeWorkingPattern($xeroTenantId, $employeeID, $employeeWorkingPatternID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->deleteEmployeeWorkingPattern: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
EmployeeWorkingPatternID*
UUID (uuid)
Employee working pattern id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

deleteTimesheet

Deletes a timesheet


/Timesheets/{TimesheetID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$timesheetID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->deleteTimesheet($xeroTenantId, $timesheetID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->deleteTimesheet: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.timesheets Grant read-write access to payroll timesheets

Parameters

Path parameters
Name Description
TimesheetID*
UUID (uuid)
Identifier for the timesheet
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

deleteTimesheetLine

Deletes a timesheet line for a specific timesheet


/Timesheets/{TimesheetID}/Lines/{TimesheetLineID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$timesheetID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
$timesheetLineID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->deleteTimesheetLine($xeroTenantId, $timesheetID, $timesheetLineID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->deleteTimesheetLine: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.timesheets Grant read-write access to payroll timesheets

Parameters

Path parameters
Name Description
TimesheetID*
UUID (uuid)
Identifier for the timesheet
Required
TimesheetLineID*
UUID (uuid)
Identifier for the timesheet line
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getDeduction

Retrieves a single deduction by using a unique deduction ID


/Deductions/{deductionId}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$deductionId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->getDeduction($xeroTenantId, $deductionId);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getDeduction: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Path parameters
Name Description
deductionId*
UUID (uuid)
Identifier for the deduction
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getDeductions

Retrieves deductions for a specific employee


/Deductions

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$page = 56;

try {
  $result = $apiInstance->getDeductions($xeroTenantId, $page);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getDeductions: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.

getEarningsRate

Retrieves a specific earnings rates by using a unique earnings rate id


/EarningsRates/{EarningsRateID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$earningsRateID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->getEarningsRate($xeroTenantId, $earningsRateID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEarningsRate: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Path parameters
Name Description
EarningsRateID*
UUID (uuid)
Identifier for the earnings rate
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEarningsRates

Retrieves earnings rates


/EarningsRates

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$page = 56;

try {
  $result = $apiInstance->getEarningsRates($xeroTenantId, $page);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEarningsRates: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.

getEmployee

Retrieves an employees using a unique employee ID


/Employees/{EmployeeID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";

try {
  $result = $apiInstance->getEmployee($xeroTenantId, $employeeID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployee: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEmployeeLeaveBalances

Retrieves leave balances for a specific employee


/Employees/{EmployeeID}/LeaveBalances

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";

try {
  $result = $apiInstance->getEmployeeLeaveBalances($xeroTenantId, $employeeID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeeLeaveBalances: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEmployeeLeavePeriods

Retrieves leave periods for a specific employee


/Employees/{EmployeeID}/LeavePeriods

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$startDate = new DateTime("2013-10-20");
$endDate = new DateTime("Johnson");

try {
  $result = $apiInstance->getEmployeeLeavePeriods($xeroTenantId, $employeeID, $startDate, $endDate);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeeLeavePeriods: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
startDate
date (date)
Filter by start date
endDate
date (date)
Filter by end date

getEmployeeLeaveTypes

Retrieves leave types for a specific employee


/Employees/{EmployeeID}/LeaveTypes

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";

try {
  $result = $apiInstance->getEmployeeLeaveTypes($xeroTenantId, $employeeID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeeLeaveTypes: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEmployeeLeaves

Retrieves leave records for a specific employee


/Employees/{EmployeeID}/Leave

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";

try {
  $result = $apiInstance->getEmployeeLeaves($xeroTenantId, $employeeID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeeLeaves: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEmployeeOpeningBalances

Retrieves the opening balance for a specific employee


/Employees/{EmployeeID}/OpeningBalances

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";

try {
  $result = $apiInstance->getEmployeeOpeningBalances($xeroTenantId, $employeeID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeeOpeningBalances: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEmployeePayTemplates

Retrieves pay templates for a specific employee


/Employees/{EmployeeID}/PayTemplates

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";

try {
  $result = $apiInstance->getEmployeePayTemplates($xeroTenantId, $employeeID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeePayTemplates: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEmployeePaymentMethod

Retrieves available payment methods for a specific employee


/Employees/{EmployeeID}/PaymentMethods

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";

try {
  $result = $apiInstance->getEmployeePaymentMethod($xeroTenantId, $employeeID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeePaymentMethod: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEmployeeSalaryAndWage

Retrieves an employee's salary and wages record by using a unique salary and wage ID


/Employees/{EmployeeID}/SalaryAndWages/{SalaryAndWagesID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$salaryAndWagesID = "3fa85f64-5717-4562-b3fc-2c963f66afa6";

try {
  $result = $apiInstance->getEmployeeSalaryAndWage($xeroTenantId, $employeeID, $salaryAndWagesID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeeSalaryAndWage: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
SalaryAndWagesID*
UUID (uuid)
Id for single pay template earnings object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEmployeeSalaryAndWages

Retrieves an employee's salary and wages


/Employees/{EmployeeID}/SalaryAndWages

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$page = 56;

try {
  $result = $apiInstance->getEmployeeSalaryAndWages($xeroTenantId, $employeeID, $page);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeeSalaryAndWages: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.

getEmployeeTax

Retrieves tax records for a specific employee


/Employees/{EmployeeID}/Tax

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";

try {
  $result = $apiInstance->getEmployeeTax($xeroTenantId, $employeeID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeeTax: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEmployeeWorkingPattern

Retrieves employee's working patterns


/Employees/{EmployeeID}/Working-Patterns/{EmployeeWorkingPatternID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$employeeWorkingPatternID = "4ff1e5cc-9835-40d5-bb18-09f3b118db9c";

try {
  $result = $apiInstance->getEmployeeWorkingPattern($xeroTenantId, $employeeID, $employeeWorkingPatternID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeeWorkingPattern: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
EmployeeWorkingPatternID*
UUID (uuid)
Employee working pattern id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEmployeeWorkingPatterns

Retrieves employee's working patterns


/Employees/{EmployeeID}/Working-Patterns

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";

try {
  $result = $apiInstance->getEmployeeWorkingPatterns($xeroTenantId, $employeeID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployeeWorkingPatterns: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getEmployees

Retrieves employees


/Employees

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$filter = "firstName==John,lastName==Smith";
$page = 5;

try {
  $result = $apiInstance->getEmployees($xeroTenantId, $filter, $page);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getEmployees: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees
payroll.employees.read Grant read-only access to payroll employees

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
filter
String
Filter by first name and/or lastname
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.

getLeaveType

Retrieves a specific leave type by using a unique leave type ID


/LeaveTypes/{LeaveTypeID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$leaveTypeID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->getLeaveType($xeroTenantId, $leaveTypeID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getLeaveType: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Path parameters
Name Description
LeaveTypeID*
UUID (uuid)
Identifier for the leave type
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getLeaveTypes

Retrieves leave types


/LeaveTypes

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$page = 56;
$activeOnly = true;

try {
  $result = $apiInstance->getLeaveTypes($xeroTenantId, $page, $activeOnly);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getLeaveTypes: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
ActiveOnly
Boolean
Filters leave types by active status. By default the API returns all leave types.

getPayRun

Retrieves a specific pay run by using a unique pay run ID


/PayRuns/{PayRunID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$payRunID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->getPayRun($xeroTenantId, $payRunID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getPayRun: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.payruns Grant read-write access to payroll payruns
payroll.payruns.read Grant read-only access to payroll payruns

Parameters

Path parameters
Name Description
PayRunID*
UUID (uuid)
Identifier for the pay run
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getPayRunCalendar

Retrieves a specific payrun calendar by using a unique payroll calendar ID


/PayRunCalendars/{PayrollCalendarID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$payrollCalendarID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->getPayRunCalendar($xeroTenantId, $payrollCalendarID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getPayRunCalendar: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Path parameters
Name Description
PayrollCalendarID*
UUID (uuid)
Identifier for the payrun calendars
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getPayRunCalendars

Retrieves payrun calendars


/PayRunCalendars

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$page = 56;

try {
  $result = $apiInstance->getPayRunCalendars($xeroTenantId, $page);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getPayRunCalendars: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.

getPayRuns

Retrieves pay runs


/PayRuns

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$page = 56;
$status = "status_example";

try {
  $result = $apiInstance->getPayRuns($xeroTenantId, $page, $status);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getPayRuns: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.payruns Grant read-write access to payroll payruns
payroll.payruns.read Grant read-only access to payroll payruns

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
status
String
By default get payruns will return all the payruns for an organization. You can add GET https://api.xero.com/payroll.xro/2.0/payRuns?statu={PayRunStatus} to filter the payruns by status.

getPaySlip

Retrieves a specific payslip by a unique pay slip ID


/PaySlips/{PaySlipID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$paySlipID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->getPaySlip($xeroTenantId, $paySlipID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getPaySlip: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.payslip Grant read-write access to payroll payslips
payroll.payslip.read Grant read-only access to payroll payslips

Parameters

Path parameters
Name Description
PaySlipID*
UUID (uuid)
Identifier for the payslip
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getPaySlips

Retrieves payslips


/PaySlips

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$payRunID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
$page = 56;

try {
  $result = $apiInstance->getPaySlips($xeroTenantId, $payRunID, $page);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getPaySlips: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.payslip Grant read-write access to payroll payslips
payroll.payslip.read Grant read-only access to payroll payslips

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
PayRunID*
UUID (uuid)
PayrunID which specifies the containing payrun of payslips to retrieve. By default, the API does not group payslips by payrun.
Required

getReimbursement

Retrieves a specific reimbursement by using a unique reimbursement ID


/Reimbursements/{ReimbursementID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$reimbursementID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->getReimbursement($xeroTenantId, $reimbursementID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getReimbursement: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Path parameters
Name Description
ReimbursementID*
UUID (uuid)
Identifier for the reimbursement
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getReimbursements

Retrieves reimbursements


/Reimbursements

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$page = 56;

try {
  $result = $apiInstance->getReimbursements($xeroTenantId, $page);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getReimbursements: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.

getSettings

Retrieves settings


/Settings

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";

try {
  $result = $apiInstance->getSettings($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getSettings: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getStatutoryDeduction

Retrieves a specific statutory deduction by using a unique statutory deductions id


/StatutoryDeductions/{id}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$id = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->getStatutoryDeduction($xeroTenantId, $id);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getStatutoryDeduction: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Path parameters
Name Description
id*
UUID (uuid)
Identifier for the statutory deduction
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getStatutoryDeductions

Retrieves statutory deductions


/StatutoryDeductions

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$page = 56;

try {
  $result = $apiInstance->getStatutoryDeductions($xeroTenantId, $page);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getStatutoryDeductions: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.

getSuperannuation

Retrieves a specific superannuation using a unique superannuation ID


/Superannuations/{SuperannuationID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$superannuationID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->getSuperannuation($xeroTenantId, $superannuationID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getSuperannuation: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Path parameters
Name Description
SuperannuationID*
UUID (uuid)
Identifier for the superannuation
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getSuperannuations

Retrieves superannuations


/Superannuations

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$page = 56;

try {
  $result = $apiInstance->getSuperannuations($xeroTenantId, $page);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getSuperannuations: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.

getTimesheet

Retrieves a specific timesheet by using a unique timesheet ID


/Timesheets/{TimesheetID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$timesheetID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

try {
  $result = $apiInstance->getTimesheet($xeroTenantId, $timesheetID);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getTimesheet: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.timesheets Grant read-write access to payroll timesheets
payroll.timesheets.read Grant read-only access to payroll timesheets

Parameters

Path parameters
Name Description
TimesheetID*
UUID (uuid)
Identifier for the timesheet
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

getTimesheets

Retrieves timesheets


/Timesheets

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$page = 5;
$filter = "employeeId==00000000-0000-0000-0000-000000000000,payrollCalendarId==00000000-0000-0000-0000-000000000000";
$status = "Draft";
$startDate = "2019-01-02";
$endDate = "2020-01-02";
$sort = "startDate";

try {
  $result = $apiInstance->getTimesheets($xeroTenantId, $page, $filter, $status, $startDate, $endDate, $sort);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getTimesheets: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.timesheets Grant read-write access to payroll timesheets
payroll.timesheets.read Grant read-only access to payroll timesheets

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
filter
String
Filter by employeeId and/or payrollCalendarId
status
String
filter results by any timesheets with a matching timesheet status
startDate
String
filter results by any timesheets with a startDate on or after the provided date
endDate
String
filter results by any timesheets with a endDate on or before the provided date
sort
String
sort the order of timesheets returned. The default is based on the timesheets createdDate, sorted oldest to newest. Currently, the only other option is to reverse the order based on the timesheets startDate, sorted newest to oldest.

getTrackingCategories

Retrieves tracking categories


/Settings/TrackingCategories

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";

try {
  $result = $apiInstance->getTrackingCategories($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->getTrackingCategories: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.settings Grant read-write access to payroll settings
payroll.settings.read Grant read-only access to payroll settings

Parameters

Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required

revertTimesheet

Reverts a timesheet to draft


/Timesheets/{TimesheetID}/RevertToDraft

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$timesheetID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
$idempotencyKey = "KEY_VALUE";

try {
  $result = $apiInstance->revertTimesheet($xeroTenantId, $timesheetID, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->revertTimesheet: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.timesheets Grant read-write access to payroll timesheets

Parameters

Path parameters
Name Description
TimesheetID*
UUID (uuid)
Identifier for the timesheet
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.

updateEmployee

Updates an existing employee


/Employees/{EmployeeID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";
$dateOfBirth = new DateTime('2000-10-28');

$address = new XeroAPI\XeroPHP\Models\PayrollNz\Address;
$address->setAddressLine1('123 Test st');
$address->setCity('Rangiora');
$address->setPostCode('7400');
$address->setCountryName('NEW ZEALAND');

$employee = new XeroAPI\XeroPHP\Models\PayrollNz\Employee;
$employee->setFirstName('Adam');
$employee->setLastName('Adamson');
$employee->setDateOfBirth($dateOfBirth);
$employee->setAddress($address);

try {
  $result = $apiInstance->updateEmployee($xeroTenantId, $employeeID, $employee, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->updateEmployee: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
employee *
Employee
Required

updateEmployeeEarningsTemplate

Updates an earnings template records for an employee


/Employees/{EmployeeID}/PayTemplates/Earnings/{PayTemplateEarningID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$payTemplateEarningID = "3fa85f64-5717-4562-b3fc-2c963f66afa6";
$idempotencyKey = "KEY_VALUE";

$earningsTemplate = new XeroAPI\XeroPHP\Models\PayrollNz\EarningsTemplate;
$earningsTemplate->setPayTemplateEarningID('00000000-0000-0000-0000-000000000000');
$earningsTemplate->setRatePerUnit(14.25);
$earningsTemplate->setNumberOfUnits(35.5);
$earningsTemplate->setFixedAmount(50);
$earningsTemplate->setEarningsRateID('00000000-0000-0000-0000-000000000000');
$earningsTemplate->setName('Overtime Hours');
$earningsTemplates = [];
array_push($earningsTemplates, $earningsTemplate);

try {
  $result = $apiInstance->updateEmployeeEarningsTemplate($xeroTenantId, $employeeID, $payTemplateEarningID, $earningsTemplate, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->updateEmployeeEarningsTemplate: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
PayTemplateEarningID*
UUID (uuid)
Id for single pay template earnings object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
earningsTemplate *
EarningsTemplate
Required

updateEmployeeLeave

Updates leave records for a specific employee


/Employees/{EmployeeID}/Leave/{LeaveID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$leaveID = "c4be24e5-e840-4c92-9eaa-2d86cd596314";
$idempotencyKey = "KEY_VALUE";
$startDate = new DateTime('2020-10-28');
$endDate = new DateTime('2020-10-30');

$employeeLeave = new XeroAPI\XeroPHP\Models\PayrollNz\EmployeeLeave;
$employeeLeave->setLeaveTypeID('00000000-0000-0000-0000-000000000000');
$employeeLeave->setStartDate($startDate);
$employeeLeave->setEndDate($endDate);

try {
  $result = $apiInstance->updateEmployeeLeave($xeroTenantId, $employeeID, $leaveID, $employeeLeave, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->updateEmployeeLeave: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
LeaveID*
UUID (uuid)
Leave id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
employeeLeave *
EmployeeLeave
Required

updateEmployeeSalaryAndWage

Updates an employee's salary and wages record


/Employees/{EmployeeID}/SalaryAndWages/{SalaryAndWagesID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$salaryAndWagesID = "3fa85f64-5717-4562-b3fc-2c963f66afa6";
$idempotencyKey = "KEY_VALUE";

$salaryAndWage = new XeroAPI\XeroPHP\Models\PayrollNz\SalaryAndWage;
$salaryAndWage->setEarningsRateID('00000000-0000-0000-0000-000000000000');
$salaryAndWage->setNumberOfUnitsPerDay(0);
$salaryAndWage->setDaysPerWeek(0);
$salaryAndWage->setPaymentType(XeroAPI\XeroPHP\Models\PayrollNz\SalaryAndWage\PaymentTypeEnum.HOURLY);

try {
  $result = $apiInstance->updateEmployeeSalaryAndWage($xeroTenantId, $employeeID, $salaryAndWagesID, $salaryAndWage, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->updateEmployeeSalaryAndWage: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
SalaryAndWagesID*
UUID (uuid)
Id for single pay template earnings object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
salaryAndWage *
SalaryAndWage
Required

updateEmployeeTax

Updates the tax records for a specific employee


/Employees/{EmployeeID}/Tax

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$employeeID = "4ff1e5cc-9835-40d5-bb18-09fdb118db9c";
$idempotencyKey = "KEY_VALUE";
$studentLoanAsAt = new DateTime('2020-10-30');

$employeeTax = new XeroAPI\XeroPHP\Models\PayrollNz\EmployeeTax;
$employeeTax->setIrdNumber('111111111');
$employeeTax->setHasSpecialStudentLoanRate(true);
$employeeTax->setSpecialStudentLoanRatePercentage(2);
$employeeTax->setIsEligibleForKiwiSaver(true);
$employeeTax->setEsctRatePercentage(17.5);
$employeeTax->setKiwiSaverContributions(XeroAPI\XeroPHP\Models\PayrollNz\EmployeeTax\KiwiSaverContributionsEnum.MakeContributions);
$employeeTax->setKiwiSaverEmployeeContributionRatePercentage(4);
$employeeTax->setKiwiSaverEmployerSalarySacrificeContributionRatePercentage(2);
$employeeTax->setTaxCode(XeroAPI\XeroPHP\Models\PayrollNz\TaxCode\MSL);
$employeeTax->setHasStudentLoanBalance(true);
$employeeTax->setStudentLoanBalance(30.0);
$employeeTax->setStudentLoanAsAt($studentLoanAsAt);

try {
  $result = $apiInstance->updateEmployeeTax($xeroTenantId, $employeeID, $employeeTax, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->updateEmployeeTax: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.employees Grant read-write access to payroll employees

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Employee id for single object
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
employeeTax *
EmployeeTax
Required

updatePayRun

Updates a pay run


/PayRuns/{PayRunID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$payRunID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
$idempotencyKey = "KEY_VALUE";
$startDate = new DateTime('2020-10-28');
$paymentDate = new DateTime('2020-10-30');

$payRunCalendar = new XeroAPI\XeroPHP\Models\PayrollNz\PayRunCalendar;
$payRunCalendar->setCalendarType(XeroAPI\XeroPHP\Models\PayrollNz\CalendarType.WEEKLY);
$payRunCalendar->setPeriodStartDate($startDate);
$payRunCalendar->setPaymentDate($paymentDate);

try {
  $result = $apiInstance->updatePayRun($xeroTenantId, $payRunID, $payRun, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->updatePayRun: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.payruns Grant read-write access to payroll payruns

Parameters

Path parameters
Name Description
PayRunID*
UUID (uuid)
Identifier for the pay run
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
payRun *
PayRun
Required

updatePaySlipLineItems

Creates an employee pay slip


/PaySlips/{PaySlipID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$paySlipID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
$idempotencyKey = "KEY_VALUE";

$earningsLine = new XeroAPI\XeroPHP\Models\PayrollNz\EarningsLine;
$earningsLine->setEarningsLineID('00000000-0000-0000-0000-000000000000');
$earningsLine->setEarningsRateID('00000000-0000-0000-0000-000000000000');
$earningsLine->setRatePerUnit(14.25);
$earningsLine->setNumberOfUnits(35.5);
$earningsLine->setIsAverageDailyPayRate(true);
$earningsLine->setIsSystemGenerated(true);
$earningsLines = [];
array_push($earningsLines, $earningsLine);

$paySlip = new XeroAPI\XeroPHP\Models\PayrollNz\PaySlip;
$paySlip->setEarningsLines($earningsLines);

try {
  $result = $apiInstance->updatePaySlipLineItems($xeroTenantId, $paySlipID, $paySlip, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->updatePaySlipLineItems: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.payslip Grant read-write access to payroll payslips

Parameters

Path parameters
Name Description
PaySlipID*
UUID (uuid)
Identifier for the payslip
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
paySlip *
PaySlip
Required

updateTimesheetLine

Updates a timesheet line for a specific timesheet


/Timesheets/{TimesheetID}/Lines/{TimesheetLineID}

Usage and SDK Samples

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\PayrollNzApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "xeroTenantId_example";
$timesheetID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
$timesheetLineID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
$idempotencyKey = "KEY_VALUE";
$date = new DateTime('2020-10-28');

$timesheetLine = new XeroAPI\XeroPHP\Models\PayrollNz\TimesheetLine;
$timesheetLine->setTimesheetLineID('00000000-0000-0000-0000-000000000000');
$timesheetLine->setDate($date);
$timesheetLine->setEarningsRateID('00000000-0000-0000-0000-000000000000');
$timesheetLine->setTrackingItemID('00000000-0000-0000-0000-000000000000');
$timesheetLine->setNumberOfUnits(6);

try {
  $result = $apiInstance->updateTimesheetLine($xeroTenantId, $timesheetID, $timesheetLineID, $timesheetLine, $idempotencyKey);
} catch (Exception $e) {
  echo 'Exception when calling PayrollNzApi->updateTimesheetLine: ', $e->getMessage(), PHP_EOL;
}
?>

Scopes

payroll.timesheets Grant read-write access to payroll timesheets

Parameters

Path parameters
Name Description
TimesheetID*
UUID (uuid)
Identifier for the timesheet
Required
TimesheetLineID*
UUID (uuid)
Identifier for the timesheet line
Required
Header parameters
Name Description
Xero-Tenant-Id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
timesheetLine *
TimesheetLine
Required