GuidesAPI ReferenceChangelogAPI PolicyGusto Security
Guides

Run Payroll

Overview

The Run Payroll workflow provides a complete experience for running payroll for a company. It guides users through selecting a payroll, configuring employee compensation, reviewing payroll details, and submitting the payroll for processing.

Implementation

import { Payroll } from '@gusto/embedded-react-sdk'

function MyApp() {
  return <Payroll.PayrollFlow companyId="your-company-id" onEvent={() => {}} />
}

Props

NameTypeDescription
companyId RequiredstringThe associated company identifier.
onEvent RequiredfunctionSee events table for each subcomponent to see available events.
defaultValuesobjectOptional default values for the workflow.
dictionaryobjectOptional translations for component text.

Events

Event typeDescriptionData
RUN_PAYROLL_SELECTEDFired when user selects a payroll to run{ payrollId: string }
RUN_PAYROLL_BACKFired when user navigates back from payroll configurationNone
RUN_PAYROLL_CALCULATEDFired when payroll calculations are completedNone
RUN_PAYROLL_EDITFired when user makes changes to payroll configurationNone
RUN_PAYROLL_EMPLOYEE_EDITEDFired when user selects an employee to edit{ employeeId: string }
RUN_PAYROLL_EMPLOYEE_SAVEDFired when employee payroll changes are saved{ payrollPrepared: Responose from prepare payroll endpoint, employee: Response from get employee endpoint }
RUN_PAYROLL_EMPLOYEE_CANCELLEDFired when user cancels employee payroll editingNone
RUN_PAYROLL_SUBMITTEDFired when payroll is successfully submittedResponse from the Submit payroll endpoint
RUN_PAYROLL_PROCESSEDFired when payroll processing is completedNone
RUN_PAYROLL_PROCESSING_FAILEDFired when payroll processing failsError details
RUN_PAYROLL_CANCELLEDFired when a payroll is cancelled{ payrollId: string, result: Response from the Cancel payroll endpoint }
RUN_PAYROLL_SUMMARY_VIEWEDFired when user views payroll summary{ payrollId: string }
RUN_PAYROLL_RECEIPT_VIEWEDFired when user views payroll receipt{ payrollId: string }

Using Payroll Subcomponents

Run payroll components can be used to compose your own workflow, or can be rendered in isolation. For guidance on creating a custom workflow, see docs on composition.

Available Subcomponents


Payroll.PayrollLanding

Provides the main landing page for payroll operations, including tabs for running payroll and viewing payroll history.

import { Payroll } from '@gusto/embedded-react-sdk'

function MyComponent() {
  return <Payroll.PayrollLanding companyId="your-company-id" onEvent={() => {}} />
}

Props

NameTypeDescription
companyId RequiredstringThe associated company identifier.
onEvent RequiredfunctionSee events table for available events.
dictionaryobjectOptional translations for component text.

Events

Event typeDescriptionData
RUN_PAYROLL_SUMMARY_VIEWEDFired when user views payroll summary{ payrollId: string }
RUN_PAYROLL_RECEIPT_VIEWEDFired when user views payroll receipt{ payrollId: string }

Payroll.PayrollList

Displays a list of available payrolls that can be run, including pay period dates and status information. Users can run payrolls, submit calculated payrolls, skip payrolls, and view any payroll blockers.

import { Payroll } from '@gusto/embedded-react-sdk'

function MyComponent() {
  return <Payroll.PayrollList companyId="your-company-id" onEvent={() => {}} />
}

Props

NameTypeDescription
companyId RequiredstringThe associated company identifier.
onEvent RequiredfunctionSee events table for available events.
dictionaryobjectOptional translations for component text.

Events

Event typeDescriptionData
RUN_PAYROLL_SELECTEDFired when user selects a payroll to run{ payrollId: string }
REVIEW_PAYROLLFired when user selects to review a payroll{ payrollId: string }
PAYROLL_SKIPPEDFired when a payroll is successfully skipped{ payrollId: string }
RUN_PAYROLL_BLOCKERS_VIEW_ALLFired when user views all payroll blockersNone

Payroll.PayrollHistory

Displays historical payroll records with advanced filtering and management capabilities:

  • Filter payrolls by time period (3 months, 6 months, or 1 year)
  • View payroll summaries and receipts
  • Cancel processed payrolls when applicable
  • Each payroll entry shows the pay period, payroll type, pay date, status, and pay amount
function MyComponent() {
  return <Payroll.PayrollHistory companyId="your-company-id" onEvent={() => {}} />
}

Props

NameTypeDescription
companyId RequiredstringThe associated company identifier.
onEvent RequiredfunctionSee events table for available events.
dictionaryobjectOptional translations for component text.

Events

Event typeDescriptionData
RUN_PAYROLL_SUMMARY_VIEWEDFired when user views payroll summary{ payrollId: string }
RUN_PAYROLL_RECEIPT_VIEWEDFired when user views payroll receipt{ payrollId: string }
RUN_PAYROLL_CANCELLEDFired when a payroll is cancelled{ payrollId: string, result: Response from the Cancel payroll endpoint }

Payroll.PayrollConfiguration

Handles the configuration phase of payroll processing, allowing users to review and modify employee compensation before calculating the payroll.

function MyComponent() {
  return (
    <Payroll.PayrollConfiguration
      companyId="your-company-id"
      payrollId="your-payroll-id"
      onEvent={() => {}}
    />
  )
}

Props

NameTypeDescription
companyId RequiredstringThe associated company identifier.
payrollId RequiredstringThe associated payroll identifier.
alertsReactNodeOptional alert components to display.
onEvent RequiredfunctionSee events table for available events.
dictionaryobjectOptional translations for component text.

Events

Event typeDescriptionData
RUN_PAYROLL_BACKFired when user navigates backNone
RUN_PAYROLL_EMPLOYEE_EDITFired when user selects an employee to edit{ employeeId: string }
RUN_PAYROLL_EMPLOYEE_SKIPFired when user excludes an employee{ employeeId: string }
RUN_PAYROLL_EMPLOYEE_SAVEDFired when employee payroll changes are saved{ payrollPrepared: object }
RUN_PAYROLL_CALCULATEDFired when payroll calculations are completed{ payrollId: string }
RUN_PAYROLL_PROCESSING_FAILEDFired when payroll processing failsError details
RUN_PAYROLL_BLOCKERS_VIEW_ALLFired when user views all payroll blockersNone

Payroll.PayrollEditEmployee

Used for editing individual employee compensation details within a payroll. This component allows modification of employee pay rates, hours, bonuses, and other compensation elements.

function MyComponent() {
  return (
    <Payroll.PayrollEditEmployee
      employeeId="your-employee-id"
      companyId="your-company-id"
      payrollId="your-payroll-id"
      onEvent={() => {}}
    />
  )
}

Props

NameTypeDescription
employeeId RequiredstringThe associated employee identifier.
companyId RequiredstringThe associated company identifier.
payrollId RequiredstringThe associated payroll identifier.
onEvent RequiredfunctionSee events table for available events.
dictionaryobjectOptional translations for component text.

Events

Event typeDescriptionData
RUN_PAYROLL_EMPLOYEE_SAVEDFired when employee payroll compensation changes are saved{ payrollPrepared: Response from prepare payroll endpoint , employee: Response from get employee endpoint }

Payroll.PayrollOverview

Displays the final payroll overview before submission, including totals, employee details, and submission controls. Once submitted, it tracks the processing status and displays confirmation when complete.

function MyComponent() {
  return (
    <Payroll.PayrollOverview
      companyId="your-company-id"
      payrollId="your-payroll-id"
      onEvent={() => {}}
    />
  )
}

Props

NameTypeDescription
companyId RequiredstringThe associated company identifier.
payrollId RequiredstringThe associated payroll identifier.
onEvent RequiredfunctionSee events table for available events.
alertsarrayOptional array of alert objects to display.
showBackButtonbooleanOptional flag to show back button.
dictionaryobjectOptional translations for component text.

Events

Event typeDescriptionData
RUN_PAYROLL_EDITFired when user chooses to edit payrollNone
RUN_PAYROLL_BACKFired when user navigates backNone
RUN_PAYROLL_SUBMITTEDFired when payroll is successfully submittedResponse from the Submit payroll endpoint
RUN_PAYROLL_PROCESSEDFired when payroll processing is completedNone
RUN_PAYROLL_PROCESSING_FAILEDFired when payroll processing failsError details
RUN_PAYROLL_CANCELLEDFired when a payroll is cancelledResponse from the Cancel payroll endpoint
RUN_PAYROLL_RECEIPT_GETFired when user requests payroll receipt{ payrollId: string }
RUN_PAYROLL_PDF_PAYSTUB_VIEWEDFired when user views employee paystub PDF{ employeeId: string }

Payroll.PayrollReceipts

Displays a detailed receipt for a completed payroll, including all payment information, deductions, taxes, and totals. This component provides a comprehensive view of a processed payroll for record-keeping and review purposes.

import { Payroll } from '@gusto/embedded-react-sdk'

function MyComponent() {
  return <Payroll.PayrollReceipts payrollId="your-payroll-id" onEvent={() => {}} />
}

Props

NameTypeDescription
payrollId RequiredstringThe associated payroll identifier.
onEvent RequiredfunctionSee events table for available events.
showBackButtonbooleanOptional flag to show back button. Defaults to true.
dictionaryobjectOptional translations for component text.

Events

Event typeDescriptionData
RUN_PAYROLL_BACKFired when user navigates backNone

Payroll.PayrollBlocker

Displays a list of blockers that prevent payroll from being processed. Blockers indicate issues that must be resolved before a payroll can be calculated or submitted, such as missing employee information, invalid tax setups, or incomplete company configuration.

import { Payroll } from '@gusto/embedded-react-sdk'

function MyComponent() {
  return <Payroll.PayrollBlocker companyId="your-company-id" onEvent={() => {}} />
}

Props

NameTypeDescription
companyId RequiredstringThe associated company identifier.
onEvent RequiredfunctionSee events table for available events.
dictionaryobjectOptional translations for component text.

Events

This component does not emit any events. It displays blockers fetched from the API and provides information to help users resolve issues.


Payroll.ConfirmWireDetails

Provides the wire transfer confirmation workflow for payroll funding. This component displays a banner when wire transfers are awaiting funds and allows users to view wire instructions and confirm transfer details through a modal interface.

function MyComponent() {
  return (
    <Payroll.ConfirmWireDetails
      companyId="your-company-id"
      wireInId="your-wire-in-id"
      onEvent={() => {}}
    />
  )
}

Props

NameTypeDescription
companyId RequiredstringThe associated company identifier.
wireInIdstringOptional wire-in request identifier. If not provided, uses the first active wire-in request.
onEvent RequiredfunctionSee events table for available events.
dictionaryobjectOptional translations for component text.

Events

Event typeDescriptionData
PAYROLL_WIRE_START_TRANSFERFired when user initiates the wire transfer flowNone
PAYROLL_WIRE_INSTRUCTIONS_DONEFired when user completes viewing wire instructions{ selectedWireInId: string }
PAYROLL_WIRE_INSTRUCTIONS_CANCELFired when user cancels viewing wire instructionsNone
PAYROLL_WIRE_INSTRUCTIONS_SELECTFired when user selects a wire-in request{ selectedWireInId: string }
PAYROLL_WIRE_FORM_DONEFired when user completes the wire confirmation{ wireInRequest: Response from the Submit wire-in request endpoint }
PAYROLL_WIRE_FORM_CANCELFired when user cancels the wire confirmation formNone