Skip to main content

PayrollFlow

Hub for running and managing all payrolls across a company's pay schedules.

Remarks

Renders the payroll landing page and orchestrates the full run-payroll experience: selecting a payroll, configuring earnings and reimbursements, reviewing totals, submitting, and viewing receipts. Off-cycle, transition, and edit-employee steps are reachable from the same flow.

Example

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

function RunPayrollPage() {
return <Payroll.PayrollFlow companyId="a007e1ab-3595-43c2-ab4b-af7a5af2e365" onEvent={() => {}} />
}

PayrollFlowProps

Props accepted by PayrollFlow.

PropertyTypeDescription
companyIdstringIdentifier of the company whose payroll is being run.
onEventOnEventType<EventType, unknown>Callback invoked each time the component emits an event — user interactions, successful API responses, step transitions, or errors. Receives the event type constant and an optional payload whose shape varies by event. See the Event Handling guide and each component's event table for the full list of emitted events.
ConfirmWireDetailsComponent?ConfirmWireDetailsComponentTypeOptional custom component that replaces the default wire-details confirmation UI.
withReimbursements?booleanWhether reimbursement fields are shown in the payroll configuration and overview. Defaults to true.

Inherits children, className, defaultValues, dictionary, FallbackComponent, LoaderComponent from BaseComponentInterface.

Events

EventDescriptionData
runPayroll/selectedA payroll is selected to run{ payrollId: string }
payroll/reviewA calculated payroll is opened for review{ payrollId: string }
runPayroll/calculatedPayroll calculations complete
runPayroll/editThe user returns to configuration to make changes
runPayroll/employee/editAn employee row is opened for editing{ employeeId: string, firstName: string, lastName: string }
runPayroll/employee/savedEmployee payroll changes are saved{ payrollPrepared: object, employee: object }
runPayroll/employee/cancelledEmployee editing is cancelled
runPayroll/submittedPayroll is successfully submittedResponse from the submit payroll endpoint
runPayroll/processedPayroll processing completes
runPayroll/processingFailedPayroll processing failsError details
runPayroll/cancelledA submitted payroll is cancelled{ payrollId: string, result: object }
runPayroll/summary/viewedThe summary screen is opened{ payrollId: string }
runPayroll/receipt/viewedThe receipt screen is opened{ payrollId: string }
runPayroll/offCycle/startThe user starts an off-cycle payroll
transition/runPayrollThe user starts a pending transition payroll
payroll/saveAndExitThe user clicks Save and Exit

Sub-components

ComponentDescription
PayrollLandingMain landing surface for payroll operations, with tabs for running payroll and viewing payroll history, plus inline navigation to a payroll's overview and receipt.
PayrollExecutionFlowGuided flow to configure, review, and submit a single payroll.
OffCycleFlowGuided flow to create and run a bonus or correction payroll.
TransitionFlowGuided flow to run a transition payroll when employees move from one pay schedule to another.
PayrollBlockerListDisplays the list of blockers preventing payroll from being processed for a company.
PayrollOverviewFinal review screen for a calculated payroll before submission, with submit, cancel, and edit controls. After submission, tracks processing status and surfaces the receipt and per-employee paystub downloads once complete.
PayrollReceiptsDisplays a detailed receipt for a completed payroll, including the debited total, per-category breakdown, tax breakdown, and a per-employee summary of payment method, garnishments, reimbursements, taxes, and net pay.

Step flow

PayrollFlow opens on the landing page (PayrollLanding), which lists pending and calculated payrolls and acts as the hub: every path launches from it and returns to it, so the flow has no terminal step. Selecting a payroll to run (runPayroll/selected) or reviewing a calculated one (payroll/review) hands off to PayrollExecutionFlow; starting an off-cycle payroll (runPayroll/offCycle/start) or a pending transition payroll (transition/runPayroll) hands off to OffCycleFlow or TransitionFlow; and viewing all blockers (runPayroll/blockers/viewAll) opens PayrollBlockerList.

When any run path finishes processing (runPayroll/processed), the flow lands on the submitted overview (PayrollOverview), which can drill into receipts (runPayroll/receipt/getPayrollReceipts). Returning to the landing hub happens via the breadcrumb header (breadcrumb/navigate) or Save & exit (payroll/saveAndExit) — here both are handled internally, returning to landing rather than exiting. A submitted payroll that is later cancelled (runPayroll/cancelled) also returns to landing, where a cancellation alert is shown.

Endpoints