Net to Gross

In this example we will step through the process of creating a Net to Gross payment.

What is Net to Gross?
A common requirement [of umbrella company payrolls] is to find the gross amount needed in order to receive a known net payment.

Step 1 - Create an Employer

The initial step when creating a new payroll is the generation of the Employer entity. An employer typically represents a single PAYE scheme. In this example we specify a simplified instance of an employer. A real world example would include, HMRC settings, bank account details, auto enrolment values and the company address.

curl -X POST \
  'https://api.test.payrun.io/Employers' \
  -H 'Accept: application/xml' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/xml' \
  -d '<?xml version="1.0"?>
<Employer xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <EffectiveDate>2018-04-06</EffectiveDate>
  <Revision>0</Revision>
  <Name>Net To Gross</Name>
  <Region>NotSet</Region>
  <Territory>UnitedKingdom</Territory>
  <BacsServiceUserNumber xsi:nil="true" />
  <RuleExclusions>None</RuleExclusions>
  <ClaimEmploymentAllowance>false</ClaimEmploymentAllowance>
  <ClaimSmallEmployerRelief>false</ClaimSmallEmployerRelief>
  <ApprenticeshipLevyAllowance>0</ApprenticeshipLevyAllowance>
  <Address xsi:nil="true" />
  <HmrcSettings xsi:nil="true" />
  <BankAccount xsi:nil="true" />
  <AutoEnrolment xsi:nil="true" />
</Employer>'
curl -X POST \
  'https://api.test.payrun.io/Employers' \
  -H 'Accept: application/json' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/json' \
  -d '{
  "Employer": {
    "EffectiveDate": "2018-04-06",
    "Revision": "0",
    "Name": "Net To Gross",
    "Region": "NotSet",
    "Territory": "UnitedKingdom",
    "BacsServiceUserNumber": null,
    "RuleExclusions": "None",
    "ClaimEmploymentAllowance": "false",
    "ClaimSmallEmployerRelief": "false",
    "ApprenticeshipLevyAllowance": "0",
    "Address": null,
    "HmrcSettings": null,
    "BankAccount": null,
    "AutoEnrolment": null
  }
}'

Because we created the employer using the [POST] method, the system has auto-generated the unique resource location key.
Auto-generated keys follow a pattern of prefix letters followed by an incrementing numeric value. The default unique key for an employer would be ER001 followed by ER002, etc.

Step 2 - Create a Pay Schedule

A pay schedule represents a grouping of employees under a common pay frequency; an employer can have many pay schedules, but an employee can only reside in a single schedule at any one time. In this example we create a schedule entitled "My weekly" with a weekly payment frequency.
Using the [PUT] verb, we explicitly specify the resource location: /Employer/ER001/PaySchedule/WEEKLY.

curl -X PUT \
  'https://api.test.payrun.io/Employer/ER001/PaySchedule/WEEKLY' \
  -H 'Accept: application/xml' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/xml' \
  -d '<?xml version="1.0"?>
<PaySchedule xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Name>My Weekly</Name>
  <PayFrequency>Weekly</PayFrequency>
</PaySchedule>'
curl -X PUT \
  'https://api.test.payrun.io/Employer/ER001/PaySchedule/WEEKLY' \
  -H 'Accept: application/json' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/json' \
  -d '{
  "PaySchedule": {
    "Name": "My Weekly",
    "PayFrequency": "Weekly"
  }
}'

Step 3 - Create an Employee

The employee object holds (and links to) the necessary data to calculate and report within the payroll. You can have an unlimited number of employees under an employer, but each can only be assigned to a single pay schedule at any given time.
Once again, we use a sparse example. A real world employee would include additional data.

curl -X POST \
  'https://api.test.payrun.io/Employer/ER001/Employees' \
  -H 'Accept: application/xml' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/xml' \
  -d '<?xml version="1.0"?>
<Employee xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <EffectiveDate>2018-04-06</EffectiveDate>
  <Revision>0</Revision>
  <Code>EMP001</Code>
  <FirstName>Weekly</FirstName>
  <LastName>GrossUp</LastName>
  <DateOfBirth>1980-01-01</DateOfBirth>
  <Gender>Male</Gender>
  <RuleExclusions>None</RuleExclusions>
  <NicLiability>IsFullyLiable</NicLiability>
  <Region>England</Region>
  <Territory>UnitedKingdom</Territory>
  <PaySchedule href="/Employer/ER001/PaySchedule/WEEKLY" />
  <StartDate>2018-04-06</StartDate>
  <WorkingWeek>AllWeekDays</WorkingWeek>
  <HoursPerWeek>40.00</HoursPerWeek>
  <AEAssessmentOverride>None</AEAssessmentOverride>
</Employee>'
curl -X POST \
  'https://api.test.payrun.io/Employer/ER001/Employees' \
  -H 'Accept: application/json' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/json' \
  -d '{
  "Employee": {
    "EffectiveDate": "2018-04-06",
    "Code": "EMP001",
    "FirstName": "Weekly",
    "LastName": "GrossUp",
    "DateOfBirth": "1980-01-01",
    "Gender": "Male",
    "RuleExclusions": "None",
    "NicLiability": "IsFullyLiable",
    "Region": "England",
    "Territory": "UnitedKingdom",
    "PaySchedule": {
      "@href": "/Employer/ER001/PaySchedule/WEEKLY"
    },
    "StartDate": "2018-04-06",
    "RuleExclusions": "None",
    "WorkingWeek": "AllWeekDays",
    "HoursPerWeek": "40.00",
    "AEAssessmentOverride": "None"
  }
}'

Step 4 - Create a Net to Gross Pay Instruction

The net to gross pay instruction details the desired net amount of pay. During the calculation process, the required gross is determined. The gross amount will include all the deduction amounts needed to achieve the desired net.
In this example, the employee requires a net payment of £1,000.00.

curl -X POST \
  'https://api.test.payrun.io/Employer/ER001/Employee/EE001/PayInstructions' \
  -H 'Accept: application/xml' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/xml' \
  -d '<?xml version="1.0"?>
<NetToGrossPayInstruction xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <StartDate>2018-04-06</StartDate>
  <EndDate>2018-04-12</EndDate>
  <Description xsi:nil="true" />
  <PayLineTag xsi:nil="true" />
  <Code>BASIC</Code>
  <CalculationMode>NetPay</CalculationMode>
  <DesiredValue>1000.00</DesiredValue>
  <Units xsi:nil="true" />
  <RateUoM xsi:nil="true" />
</NetToGrossPayInstruction>'
curl -X POST \
  'https://api.test.payrun.io/Employer/ER001/Employee/EE001/PayInstructions' \
  -H 'Accept: application/json' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/json' \
  -d '{
  "NetToGrossPayInstruction": {
    "StartDate": "2018-04-06",
    "EndDate": "2018-04-12",
    "Description": null,
    "PayLineTag": null,
    "Code": "BASIC",
    "CalculationMode": "NetPay",
    "DesiredValue": "1000.00",
    "Units": null,
    "RateUoM": null
  }
}'

Step 5 - Create a Pay Run Job

Payroll calculations are performed on a background process. This is controlled using jobs. The user enqueues a "PayRunJob", receives a link to the job info resource and then polls the job status waiting for the job to complete.
In this example we enqueue a new pay run job for the first week in the tax year.

curl -X POST \
  'https://api.test.payrun.io/jobs/payruns' \
  -H 'Accept: application/xml' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/xml' \
  -d '<?xml version="1.0"?>
<PayRunJobInstruction xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <HoldingDate xsi:nil="true" />
  <PaymentDate>2018-04-10</PaymentDate>
  <StartDate>2018-04-06</StartDate>
  <EndDate>2018-04-12</EndDate>
  <PaySchedule href="/Employer/ER001/PaySchedule/WEEKLY" />
  <IsSupplementary>false</IsSupplementary>
  <Employees />
</PayRunJobInstruction>'
curl -X POST \
  'https://api.test.payrun.io/jobs/payruns' \
  -H 'Accept: application/json' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/json' \
  -d '{
  "PayRunJobInstruction": {
    "HoldingDate": null,
    "PaymentDate": "2018-04-10",
    "StartDate": "2018-04-06",
    "EndDate": "2018-04-12",
    "PaySchedule": {
      "@href": "/Employer/ER001/PaySchedule/WEEKLY"
    },
    "IsSupplementary": "false",
    "Employees": { "Employee": [] }
  }
}'

Step 6 - Query Pay Run Job Status

In this step we monitor the pay run job progress, waiting for successful completion.

curl -X GET \
  'https://api.test.payrun.io/jobs/payruns/520b5a10-2c17-41da-930c-3f7aec5a94c3/info' \
  -H 'Accept: application/xml' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/xml'
curl -X GET \
  'https://api.test.payrun.io/jobs/payruns/520b5a10-2c17-41da-930c-3f7aec5a94c3/info' \
  -H 'Accept: application/json' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/json'

Response Example

<?xml version="1.0"?>
<JobInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <JobId>19002f3d-6941-4bf7-a2bf-3fc6b57a65e1</JobId>
  <Created>2018-11-29T12:52:33.7933333</Created>
  <LastUpdated>2018-11-29T12:52:34.7966667</LastUpdated>
  <JobType>PayRunJob</JobType>
  <JobStatus>Success</JobStatus>
  <Progress>1.000</Progress>
  <HoldingDate xsi:nil="true" />
  <Errors />
</JobInfo>
{
  "JobInfo": {
    "JobId": "520b5a10-2c17-41da-930c-3f7aec5a94c3",
    "Created": "2018-11-29T12:52:14.71",
    "LastUpdated": "2018-11-29T12:52:31.3533333",
    "JobType": "PayRunJob",
    "JobStatus": "Success",
    "Progress": "1.000",
    "HoldingDate": null,
    "Errors": { "Error": [] }
  }
}

Step 7 - Review Calculation Commentary

Every employee calculation results in a Calculation Commentary report. This provides a running commentary of the actions taken through out the pay run calculation process.
Looking into the "Net to Gross" section of this report, we can see the result of our gross-up calculation.

curl -X GET \
  'https://api.test.payrun.io/Employer/ER001/Employee/EE001/Commentary/C001' \
  -H 'Accept: application/xml' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/xml'
curl -X GET \
  'https://api.test.payrun.io/Employer/ER001/Employee/EE001/Commentary/C001' \
  -H 'Accept: application/json' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/json'

Response Example

<?xml version="1.0"?>
<Commentary xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Created>2018-11-29T12:52:34.7227667</Created>
  <Detail>12:52:34.546 [INFO ] -- Begin Calculation
12:52:34.546 [INFO ] --   Employee: Weekly, GrossUp
12:52:34.546 [INFO ] --   Tax Period: W01-2018/19
12:52:34.546 [INFO ] --   Pay Day: 2018-04-10 
12:52:34.546 [INFO ] --   Pay Frequency: Weekly
12:52:34.546 [INFO ] --   Start Pre-calculations Rules
12:52:34.547 [DEBUG] --     Rule matched: Tax &gt; Emergency Tax pay instruction
12:52:34.547 [DEBUG] --       New Tax instruction created with tax code: 1185L
12:52:34.547 [DEBUG] --     Rule matched: NI &gt; Create Missing NI pay instruction
12:52:34.548 [DEBUG] --       New NI instruction for letter A created.
12:52:34.548 [INFO ] --     Total Rules: 17 - Excluded: 0 - Matched: 2
12:52:34.548 [INFO ] --   End Pre-calculations Rules
**12:52:34.548 [INFO ] --   Begin Net to Gross Calculator**
**12:52:34.710 [INFO ] --     Calculate required gross to achieve desired net: 1000.0000**
**12:52:34.710 [DEBUG] --       Desired net     :   1,000.00**
**12:52:34.710 [DEBUG] --       Required gross  :   1,458.22**
**12:52:34.710 [INFO ] --     Added payline: 'BASIC' with grossed up value: 1,458.22**
**12:52:34.710 [INFO ] --   End Net to Gross Calculator**
12:52:34.710 [INFO ] --   Begin Tax Calculator
12:52:34.717 [INFO ] --     Tax Code: 1185L
12:52:34.717 [INFO ] --     Tax Basis: Week1Month1
12:52:34.717 [INFO ] --     Taxable Gross: 1,458.22
12:52:34.717 [INFO ] --       Taxable Pay: 1,458.22
12:52:34.717 [INFO ] --       Taxable Benefits: 0.00
12:52:34.717 [INFO ] --       Taxable Deduction: 0.00
12:52:34.717 [INFO ] --       Freepay: 228.07
12:52:34.717 [DEBUG] --       Taxable Pay: (Total Pay - Freepay)
12:52:34.717 [DEBUG] --       Taxable Pay: (1,458.22 - 228.07) = 1,230.15
12:52:34.717 [DEBUG] --         Tax Bands:
12:52:34.717 [DEBUG] --           | Name                     | Lower           | Upper           | Rate %          |
12:52:34.717 [DEBUG] --           |------------------------- |---------------- |---------------- |---------------- |
12:52:34.717 [DEBUG] --           | Basic Rate               | 0.00            | 34,500.00       | 20.00%          |
12:52:34.717 [DEBUG] --           | Higher Rate              | 34,500.00       | 150,000.00      | 40.00%          |
12:52:34.717 [DEBUG] --           | Additional Higher Rate   | 150,000.00      |                 | 45.00%          |
12:52:34.717 [DEBUG] --           |------------------------- |---------------- |---------------- |---------------- |
12:52:34.717 [INFO ] --       Calculate untaxed taxable period pay within bands
12:52:34.717 [INFO ] --         Basic Rate               : (0.00 -&gt; 34,500.00) = 663.46
12:52:34.717 [INFO ] --         Higher Rate              : (34,500.00 -&gt; 150,000.00) = 566.54
12:52:34.717 [INFO ] --         Additional Higher Rate   : (150,000.00 -&gt; ) = 0.00
12:52:34.717 [INFO ] --       Calculate tax by band
12:52:34.717 [DEBUG] --         Basic Rate               : (663.46 * 20.00%) = 132.6923
12:52:34.717 [DEBUG] --         Higher Rate              : (566.54 * 40.00%) = 226.6154
12:52:34.717 [DEBUG] --         Additional Higher Rate   : (0.00 * 45.00%) = 0.0000
12:52:34.717 [INFO ] --       Total Tax: SUM(132.6923, 226.6154, 0.0000) = ROUNDPENNYDOWN(359.3076) = 359.30
12:52:34.717 [INFO ] --     Total Period Tax  :  359.30
12:52:34.717 [INFO ] --   End Tax Calculator
12:52:34.717 [INFO ] --   Begin National Insurance Calculator
12:52:34.720 [INFO ] --     Pay Frequency: Weekly
12:52:34.720 [INFO ] --     Period: W01-2018/19
12:52:34.721 [INFO ] --     Niable Pay: 1,458.22
12:52:34.721 [INFO ] --     NI Letter: A
12:52:34.721 [DEBUG] --       NI Bandings
12:52:34.721 [DEBUG] --         | Name         | Lower        | Upper        | EE %         | ER %         | EE Rebate %  | ER Rebate %  |
12:52:34.721 [DEBUG] --         |------------- |------------- |------------- |------------- |------------- |------------- |------------- |
12:52:34.721 [DEBUG] --         | Below LEL    | 0.00         | 116.00       | 0.00%        | 0.00%        | 0.00%        | 0.00%        |
12:52:34.721 [DEBUG] --         | LEL to PT    | 116.00       | 162.00       | 0.00%        | 0.00%        | 0.00%        | 0.00%        |
12:52:34.721 [DEBUG] --         | PT to ST     | 162.00       | 162.00       | 12.00%       | 0.00%        | 0.00%        | 0.00%        |
12:52:34.721 [DEBUG] --         | ST to UST    | 162.00       | 892.00       | 12.00%       | 13.80%       | 0.00%        | 0.00%        |
12:52:34.721 [DEBUG] --         | UST to UEL   | 892.00       | 892.00       | 2.00%        | 13.80%       | 0.00%        | 0.00%        |
12:52:34.721 [DEBUG] --         | Above UEL    | 892.00       |              | 2.00%        | 13.80%       | 0.00%        | 0.00%        |
12:52:34.721 [DEBUG] --         |------------- |------------- |------------- |------------- |------------- |------------- |------------- |
12:52:34.721 [INFO ] --     Calculate Niable pay within bands
12:52:34.721 [INFO ] --       Below LEL  : (0.00 -&gt; 116.00) = 116.00
12:52:34.721 [INFO ] --       LEL to PT  : (116.00 -&gt; 162.00) = 46.00
12:52:34.721 [INFO ] --       PT to ST   : (162.00 -&gt; 162.00) = 0.00
12:52:34.721 [INFO ] --       ST to UST  : (162.00 -&gt; 892.00) = 730.00
12:52:34.721 [INFO ] --       UST to UEL : (892.00 -&gt; 892.00) = 0.00
12:52:34.721 [INFO ] --       Above UEL  : (892.00 -&gt; ) = 566.22
12:52:34.721 [INFO ] --     Calculate Employees NIC
12:52:34.721 [DEBUG] --       LEL to PT   : NIROUND(46.00 * 0.00%) = 0.00
12:52:34.721 [DEBUG] --       PT to ST    : NIROUND(0.00 * 12.00%) = 0.00
12:52:34.721 [DEBUG] --       ST to UST   : NIROUND(730.00 * 12.00%) = 87.60
12:52:34.721 [DEBUG] --       UST to UEL  : NIROUND(0.00 * 2.00%) = 0.00
12:52:34.721 [DEBUG] --       Above UEL   : NIROUND(566.22 * 2.00%) = 11.32
12:52:34.721 [INFO ] --     Employee NIC: SUM(0.00, 0.00, 87.60, 0.00, 11.32) = -98.92
12:52:34.721 [INFO ] --     Employee NIC:  = -98.92
12:52:34.721 [INFO ] --     Calculate Employers NIC
12:52:34.721 [DEBUG] --       LEL to PT   : NIROUND(46.00 * 0.00%) = 0.00
12:52:34.721 [DEBUG] --       PT to ST    : NIROUND(0.00 * 0.00%) = 0.00
12:52:34.721 [DEBUG] --       ST to UST   : NIROUND(730.00 * 13.80%) = 100.74
12:52:34.721 [DEBUG] --       UST to UEL  : NIROUND(0.00 * 13.80%) = 0.00
12:52:34.721 [DEBUG] --       Above UEL   : NIROUND(566.22 * 13.80%) = 78.14
12:52:34.721 [INFO ] --     Employer NIC: SUM(0.00, 0.00, 100.74, 0.00, 78.14) = -178.88
12:52:34.721 [INFO ] --     Employer NIC: = -178.88
12:52:34.721 [INFO ] --   End National Insurance Calculator
12:52:34.721 [INFO ] --   Begin Auto Enrolment Assessment
12:52:34.722 [DEBUG] --     Step 1 - Assert auto enrolment is configured
12:52:34.722 [DEBUG] --       Employer revision exists
12:52:34.722 [DEBUG] --       No employer auto enrolment settings found
12:52:34.722 [DEBUG] --       No assessment can be made
12:52:34.722 [INFO ] --   End Auto Enrolment Assessment
12:52:34.722 [INFO ] --     Payslip
12:52:34.722 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |
12:52:34.722 [INFO ] --       | Payments                                   | Amount £     | Deductions                                 | Amount £     |
12:52:34.722 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |
12:52:34.722 [INFO ] --       | Basic Pay                                  | 1,458.22     | Tax                                        | -359.30      |
12:52:34.722 [INFO ] --       |                                            |              | National Insurance                         | -98.92       |
12:52:34.722 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |
12:52:34.722 [INFO ] --       | NET PAY                                    | 1,000.00     |
12:52:34.722 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |
12:52:34.722 [INFO ] --       | This Period                                | Amount £     | Year to Date                               | Amount £     |
12:52:34.722 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |
12:52:34.722 [INFO ] --       | Employer NI                                | -178.88      | Employer NI                                | -178.88      |
12:52:34.722 [INFO ] --       | Employee NI                                | -98.92       | Employee NI                                | -98.92       |
12:52:34.722 [INFO ] --       | Niable Pay                                 | 1,458.22     | Niable Pay                                 | 1,458.22     |
12:52:34.722 [INFO ] --       | Taxable Pay                                | 1,458.22     | Taxable Pay                                | 1,458.22     |
12:52:34.722 [INFO ] --       | Tax Paid                                   | -359.30      | Tax Paid                                   | -359.30      |
12:52:34.722 [INFO ] --       | Taxable Benefits                           | 0.00         | Taxable Benefits                           | 0.00         |
12:52:34.722 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |
12:52:34.722 [INFO ] --     Payslip Report : /Report/PAYSLIP3/run?EmployerKey=ER001&amp;TaxYear=2018&amp;PayScheduleKey=WEEKLY&amp;PaymentDate=2018-04-10&amp;EmployeeCodes=EMP001
12:52:34.722 [INFO ] --     PDF Payslip    : /Report/PAYSLIP3/run?EmployerKey=ER001&amp;TaxYear=2018&amp;PayScheduleKey=WEEKLY&amp;PaymentDate=2018-04-10&amp;EmployeeCodes=EMP001&amp;TransformDefinitionKey=Payslip-A5-Basic-Pdf
12:52:34.722 [INFO ] -- End Calculation</Detail>
</Commentary>
{
  "Commentary": {
    "Created": "2018-11-29T12:52:30.3269119",
    "Detail": "12:52:29.329 [INFO ] -- Begin Calculation\r\n
12:52:29.330 [INFO ] --   Employee: Weekly, GrossUp\r\n
12:52:29.330 [INFO ] --   Tax Period: W01-2018/19\r\n
12:52:29.334 [INFO ] --   Pay Day: 2018-04-10 \r\n
12:52:29.334 [INFO ] --   Pay Frequency: Weekly\r\n
12:52:29.393 [INFO ] --   Start Pre-calculations Rules\r\n
12:52:29.415 [DEBUG] --     Rule matched: Tax > Emergency Tax pay instruction\r\n
12:52:29.421 [DEBUG] --       New Tax instruction created with tax code: 1185L\r\n
12:52:29.422 [DEBUG] --     Rule matched: NI > Create Missing NI pay instruction\r\n
12:52:29.448 [DEBUG] --       New NI instruction for letter A created.\r\n
12:52:29.459 [INFO ] --     Total Rules: 17 - Excluded: 0 - Matched: 2\r\n
12:52:29.459 [INFO ] --   End Pre-calculations Rules\r\n
**12:52:29.461 [INFO ] --   Begin Net to Gross Calculator**\r\n
**12:52:30.314 [INFO ] --     Calculate required gross to achieve desired net: 1000.0000**\r\n
**12:52:30.314 [DEBUG] --       Desired net     :   1,000.00**\r\n
**12:52:30.314 [DEBUG] --       Required gross  :   1,458.22**\r\n
**12:52:30.314 [INFO ] --     Added payline: 'BASIC' with grossed up value: 1,458.22**\r\n
**12:52:30.314 [INFO ] --   End Net to Gross Calculator**\r\n
12:52:30.314 [INFO ] --   Begin Tax Calculator\r\n
12:52:30.322 [INFO ] --     Tax Code: 1185L\r\n
12:52:30.322 [INFO ] --     Tax Basis: Week1Month1\r\n
12:52:30.322 [INFO ] --     Taxable Gross: 1,458.22\r\n
12:52:30.322 [INFO ] --       Taxable Pay: 1,458.22\r\n
12:52:30.322 [INFO ] --       Taxable Benefits: 0.00\r\n
12:52:30.322 [INFO ] --       Taxable Deduction: 0.00\r\n
12:52:30.322 [INFO ] --       Freepay: 228.07\r\n
12:52:30.322 [DEBUG] --       Taxable Pay: (Total Pay - Freepay)\r\n
12:52:30.322 [DEBUG] --       Taxable Pay: (1,458.22 - 228.07) = 1,230.15\r\n
12:52:30.322 [DEBUG] --         Tax Bands:\r\n
12:52:30.322 [DEBUG] --           | Name                     | Lower           | Upper           | Rate %          |\r\n
12:52:30.322 [DEBUG] --           |------------------------- |---------------- |---------------- |---------------- |\r\n
12:52:30.322 [DEBUG] --           | Basic Rate               | 0.00            | 34,500.00       | 20.00%          |\r\n
12:52:30.322 [DEBUG] --           | Higher Rate              | 34,500.00       | 150,000.00      | 40.00%          |\r\n
12:52:30.322 [DEBUG] --           | Additional Higher Rate   | 150,000.00      |                 | 45.00%          |\r\n
12:52:30.322 [DEBUG] --           |------------------------- |---------------- |---------------- |---------------- |\r\n
12:52:30.322 [INFO ] --       Calculate untaxed taxable period pay within bands\r\n
12:52:30.322 [INFO ] --         Basic Rate               : (0.00 -> 34,500.00) = 663.46\r\n
12:52:30.322 [INFO ] --         Higher Rate              : (34,500.00 -> 150,000.00) = 566.54\r\n
12:52:30.322 [INFO ] --         Additional Higher Rate   : (150,000.00 -> ) = 0.00\r\n
12:52:30.322 [INFO ] --       Calculate tax by band\r\n
12:52:30.322 [DEBUG] --         Basic Rate               : (663.46 * 20.00%) = 132.6923\r\n
12:52:30.322 [DEBUG] --         Higher Rate              : (566.54 * 40.00%) = 226.6154\r\n
12:52:30.322 [DEBUG] --         Additional Higher Rate   : (0.00 * 45.00%) = 0.0000\r\n
12:52:30.322 [INFO ] --       Total Tax: SUM(132.6923, 226.6154, 0.0000) = ROUNDPENNYDOWN(359.3076) = 359.30\r\n
12:52:30.322 [INFO ] --     Total Period Tax  :  359.30\r\n
12:52:30.322 [INFO ] --   End Tax Calculator\r\n
12:52:30.322 [INFO ] --   Begin National Insurance Calculator\r\n
12:52:30.324 [INFO ] --     Pay Frequency: Weekly\r\n
12:52:30.324 [INFO ] --     Period: W01-2018/19\r\n
12:52:30.325 [INFO ] --     Niable Pay: 1,458.22\r\n
12:52:30.325 [INFO ] --     NI Letter: A\r\n
12:52:30.325 [DEBUG] --       NI Bandings\r\n
12:52:30.325 [DEBUG] --         | Name         | Lower        | Upper        | EE %         | ER %         | EE Rebate %  | ER Rebate %  |\r\n
12:52:30.325 [DEBUG] --         |------------- |------------- |------------- |------------- |------------- |------------- |------------- |\r\n
12:52:30.325 [DEBUG] --         | Below LEL    | 0.00         | 116.00       | 0.00%        | 0.00%        | 0.00%        | 0.00%        |\r\n
12:52:30.325 [DEBUG] --         | LEL to PT    | 116.00       | 162.00       | 0.00%        | 0.00%        | 0.00%        | 0.00%        |\r\n
12:52:30.325 [DEBUG] --         | PT to ST     | 162.00       | 162.00       | 12.00%       | 0.00%        | 0.00%        | 0.00%        |\r\n
12:52:30.325 [DEBUG] --         | ST to UST    | 162.00       | 892.00       | 12.00%       | 13.80%       | 0.00%        | 0.00%        |\r\n
12:52:30.325 [DEBUG] --         | UST to UEL   | 892.00       | 892.00       | 2.00%        | 13.80%       | 0.00%        | 0.00%        |\r\n
12:52:30.325 [DEBUG] --         | Above UEL    | 892.00       |              | 2.00%        | 13.80%       | 0.00%        | 0.00%        |\r\n
12:52:30.325 [DEBUG] --         |------------- |------------- |------------- |------------- |------------- |------------- |------------- |\r\n
12:52:30.325 [INFO ] --     Calculate Niable pay within bands\r\n
12:52:30.325 [INFO ] --       Below LEL  : (0.00 -> 116.00) = 116.00\r\n
12:52:30.325 [INFO ] --       LEL to PT  : (116.00 -> 162.00) = 46.00\r\n
12:52:30.325 [INFO ] --       PT to ST   : (162.00 -> 162.00) = 0.00\r\n
12:52:30.325 [INFO ] --       ST to UST  : (162.00 -> 892.00) = 730.00\r\n
12:52:30.325 [INFO ] --       UST to UEL : (892.00 -> 892.00) = 0.00\r\n
12:52:30.325 [INFO ] --       Above UEL  : (892.00 -> ) = 566.22\r\n
12:52:30.325 [INFO ] --     Calculate Employees NIC\r\n
12:52:30.325 [DEBUG] --       LEL to PT   : NIROUND(46.00 * 0.00%) = 0.00\r\n
12:52:30.325 [DEBUG] --       PT to ST    : NIROUND(0.00 * 12.00%) = 0.00\r\n
12:52:30.325 [DEBUG] --       ST to UST   : NIROUND(730.00 * 12.00%) = 87.60\r\n
12:52:30.325 [DEBUG] --       UST to UEL  : NIROUND(0.00 * 2.00%) = 0.00\r\n
12:52:30.325 [DEBUG] --       Above UEL   : NIROUND(566.22 * 2.00%) = 11.32\r\n
12:52:30.325 [INFO ] --     Employee NIC: SUM(0.00, 0.00, 87.60, 0.00, 11.32) = -98.92\r\n
12:52:30.325 [INFO ] --     Employee NIC:  = -98.92\r\n
12:52:30.325 [INFO ] --     Calculate Employers NIC\r\n
12:52:30.325 [DEBUG] --       LEL to PT   : NIROUND(46.00 * 0.00%) = 0.00\r\n
12:52:30.325 [DEBUG] --       PT to ST    : NIROUND(0.00 * 0.00%) = 0.00\r\n
12:52:30.325 [DEBUG] --       ST to UST   : NIROUND(730.00 * 13.80%) = 100.74\r\n
12:52:30.325 [DEBUG] --       UST to UEL  : NIROUND(0.00 * 13.80%) = 0.00\r\n
12:52:30.325 [DEBUG] --       Above UEL   : NIROUND(566.22 * 13.80%) = 78.14\r\n
12:52:30.325 [INFO ] --     Employer NIC: SUM(0.00, 0.00, 100.74, 0.00, 78.14) = -178.88\r\n
12:52:30.325 [INFO ] --     Employer NIC: = -178.88\r\n
12:52:30.325 [INFO ] --   End National Insurance Calculator\r\n
12:52:30.325 [INFO ] --   Begin Auto Enrolment Assessment\r\n
12:52:30.325 [DEBUG] --     Step 1 - Assert auto enrolment is configured\r\n
12:52:30.325 [DEBUG] --       Employer revision exists\r\n
12:52:30.325 [DEBUG] --       No employer auto enrolment settings found\r\n
12:52:30.325 [DEBUG] --       No assessment can be made\r\n
12:52:30.325 [INFO ] --   End Auto Enrolment Assessment\r\n
12:52:30.326 [INFO ] --     Payslip\r\n
12:52:30.326 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |\r\n
12:52:30.326 [INFO ] --       | Payments                                   | Amount £     | Deductions                                 | Amount £     |\r\n
12:52:30.326 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |\r\n
12:52:30.326 [INFO ] --       | Basic Pay                                  | 1,458.22     | Tax                                        | -359.30      |\r\n
12:52:30.326 [INFO ] --       |                                            |              | National Insurance                         | -98.92       |\r\n
12:52:30.326 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |\r\n
12:52:30.326 [INFO ] --       | NET PAY                                    | 1,000.00     |\r\n
12:52:30.326 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |\r\n
12:52:30.326 [INFO ] --       | This Period                                | Amount £     | Year to Date                               | Amount £     |\r\n
12:52:30.326 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |\r\n
12:52:30.326 [INFO ] --       | Employer NI                                | -178.88      | Employer NI                                | -178.88      |\r\n
12:52:30.326 [INFO ] --       | Employee NI                                | -98.92       | Employee NI                                | -98.92       |\r\n
12:52:30.326 [INFO ] --       | Niable Pay                                 | 1,458.22     | Niable Pay                                 | 1,458.22     |\r\n
12:52:30.326 [INFO ] --       | Taxable Pay                                | 1,458.22     | Taxable Pay                                | 1,458.22     |\r\n
12:52:30.326 [INFO ] --       | Tax Paid                                   | -359.30      | Tax Paid                                   | -359.30      |\r\n
12:52:30.326 [INFO ] --       | Taxable Benefits                           | 0.00         | Taxable Benefits                           | 0.00         |\r\n
12:52:30.326 [INFO ] --       |------------------------------------------- |------------- |------------------------------------------- |------------- |\r\n
12:52:30.326 [INFO ] --     Payslip Report : /Report/PAYSLIP3/run?EmployerKey=ER001&TaxYear=2018&PayScheduleKey=WEEKLY&PaymentDate=2018-04-10&EmployeeCodes=EMP001\r\n
12:52:30.326 [INFO ] --     PDF Payslip    : /Report/PAYSLIP3/run?EmployerKey=ER001&TaxYear=2018&PayScheduleKey=WEEKLY&PaymentDate=2018-04-10&EmployeeCodes=EMP001&TransformDefinitionKey=Payslip-A5-Basic-Pdf\r\n
12:52:30.326 [INFO ] -- End Calculation"
  }
}

Step 8 - Get the Employee Payslip

Now the pay run job is complete, we can access the Payslip report for our employee.

Net to Gross Result
Looking into the payslip report, we can see that a payment line to the value of £ 1,458.22 was created.
This is the exact amount the employee has to earn in order to take home the desired £1,000.00 net pay amount.

curl -X GET \
  'https://api.test.payrun.io/report/PAYSLIP3/run?EmployerKey=ER001&PayScheduleKey=SCH001&TaxYear=2018&PaymentDate=2018-04-10&EmployeeCodes=EMP001' \
  -H 'Accept: application/xml' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/xml'
curl -X GET \
  'https://api.test.payrun.io/report/PAYSLIP3/run?EmployerKey=ER001&PayScheduleKey=SCH001&TaxYear=2018&PaymentDate=2018-04-10&EmployeeCodes=EMP001' \
  -H 'Accept: application/json' \
  -H 'Api-Version: default' \
  -H 'Authorization: {OAuthHeader}' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-type: application/json'

Response Example

<?xml version="1.0" encoding="utf-16"?>
<Payslip3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Generated="2018-11-29T12:52:34" Duration="00:00:00.0213403" TotalIndexCount="1">
  <Parameters>
    <Employer>ER001</Employer>
    <PaySchedule>WEEKLY [My Weekly - Weekly]</PaySchedule>
    <TaxYear>2018</TaxYear>
    <EmployeeCodes>EMP001</EmployeeCodes>
  </Parameters>
  <Employer>
    <Name>Net To Gross</Name>
    <PayeRef>/</PayeRef>
  </Employer>
  <Employee Index="1" Code="EMP001" Key="EE001" Name="Weekly GrossUp" PayDate="2018-04-10" TaxPeriod="1">
    <Link href="/Employer/ER001/Employee/EE001/2018-04-06" />
    <NiNumber></NiNumber>
    <PaymentMethod>NotSet</PaymentMethod>
    <TaxCode>1185L/W1M1</TaxCode>
    <NiLetter>A</NiLetter>
    <Payments>
      <PayLine>
        <Description>Basic Pay</Description>
        <Value>1458.22</Value>
        <Rate>0.00</Rate>
        <Units>0.00</Units>
        <UoM>NotSet</UoM>
        <YTD>1458.22</YTD>
      </PayLine>
    </Payments>
    <Deductions>
      <PayLine>
        <Description>Tax</Description>
        <Value>-359.30</Value>
        <YTD>359.30</YTD>
      </PayLine>
      <PayLine>
        <Description>National Insurance</Description>
        <Value>-98.92</Value>
        <YTD>98.92</YTD>
      </PayLine>
    </Deductions>
    <PayRunTotals>
      <NiablePay>1458.22</NiablePay>
      <TaxablePay>1458.22</TaxablePay>
      <EENI>98.92</EENI>
      <ERNI>178.88</ERNI>
      <Tax>359.30</Tax>
      <EEPension>0.00</EEPension>
      <ERPension>0.00</ERPension>
      <GrossPayments>1458.22</GrossPayments>
      <GrossDeductions>-458.22</GrossDeductions>
      <Net>1000.00</Net>
    </PayRunTotals>
    <YearToDate>
      <NiablePay>1458.22</NiablePay>
      <TaxablePay>1458.22</TaxablePay>
      <EENI>98.92</EENI>
      <ERNI>178.88</ERNI>
      <Tax>359.30</Tax>
      <EEPension>0.00</EEPension>
      <ERPension>0.00</ERPension>
      <GrossPayments>1458.22</GrossPayments>
      <GrossDeductions>-458.22</GrossDeductions>
      <Net>1000.00</Net>
    </YearToDate>
    <PreviousEmployment>
      <TaxablePay>0.00</TaxablePay>
      <Tax>0.00</Tax>
    </PreviousEmployment>
  </Employee>
</Payslip3>
{
  "Payslip3": {
    "@Generated": "2018-11-29T12:52:32",
    "@Duration": "00:00:00.8877696",
    "@TotalIndexCount": "1",
    "Parameters": {
      "Employer": "ER001",
      "PaySchedule": "WEEKLY [My Weekly - Weekly]",
      "TaxYear": "2018",
      "EmployeeCodes": "EMP001"
    },
    "Employer": {
      "Name": "Net To Gross",
      "PayeRef": "/"
    },
    "Employee": [
      {
        "@Index": "1",
        "@Code": "EMP001",
        "@Key": "EE001",
        "@Name": "Weekly GrossUp",
        "@PayDate": "2018-04-10",
        "@TaxPeriod": "1",
        "Link": {
          "@href": "/Employer/ER001/Employee/EE001/2018-04-06"
        },
        "NiNumber": "",
        "PaymentMethod": "NotSet",
        "TaxCode": "1185L/W1M1",
        "NiLetter": "A",
        "Payments": {
          "PayLine": [
            {
              "Description": "Basic Pay",
              "Value": "1458.22",
              "Rate": "0.00",
              "Units": "0.00",
              "UoM": "NotSet",
              "YTD": "1458.22"
            }
          ]
        },
        "Deductions": {
          "PayLine": [
            {
              "Description": "Tax",
              "Value": "-359.30",
              "YTD": "359.30"
            },
            {
              "Description": "National Insurance",
              "Value": "-98.92",
              "YTD": "98.92"
            }
          ]
        },
        "PayRunTotals": {
          "NiablePay": "1458.22",
          "TaxablePay": "1458.22",
          "EENI": "98.92",
          "ERNI": "178.88",
          "Tax": "359.30",
          "EEPension": "0.00",
          "ERPension": "0.00",
          "GrossPayments": "1458.22",
          "GrossDeductions": "-458.22",
          "Net": "1000.00"
        },
        "YearToDate": {
          "NiablePay": "1458.22",
          "TaxablePay": "1458.22",
          "EENI": "98.92",
          "ERNI": "178.88",
          "Tax": "359.30",
          "EEPension": "0.00",
          "ERPension": "0.00",
          "GrossPayments": "1458.22",
          "GrossDeductions": "-458.22",
          "Net": "1000.00"
        },
        "PreviousEmployment": {
          "TaxablePay": "0.00",
          "Tax": "0.00"
        }
      }
    ]
  }
}