Skip to main content
A lightweight JavaScript SDK for embedding the Payroll Integrations onboarding flow into your web application via an iframe.

Overview

The SDK mounts a secure iframe into a host element on your page and handles two-way communication between your app and the Payroll Integrations platform using the postMessage API.

Installation

Note: This package has not yet been published. Installation instructions will be added once it is available.

Usage

  1. Add a host element to your page:
<div id="pi-host"></div>
  1. Call bootstrap with the onboardingLink obtained from the Create Employer Invite Session endpoint:
import { bootstrap } from "@payroll-integrations/onboarding-sdk";

bootstrap({
  onboardingLink: "YOUR_ONBOARDING_LINK",
  callbacks: {
    success: (value) => console.log("Onboarding complete", value),
    error: (value) => console.error("Onboarding error", value),
  },
});

Configuration

A configuration object must be provided to the bootstrap function. It has the following properties: Link retrieved from the Create Employer Invite Session endpoint Type: string

selector

CSS selector for the element to mount the iframe into Type: string Default: #pi-host

callbacks.success

Called when onboarding completes successfully Type: (value: string) => unknown

callbacks.error

Called when an error occurs Type: (value: string) => unknown

callbacks.message

Called for outbound debug messages sent from the iframe Type: (value: string) => unknown

frameHost

Intended for development only. Overrides the iframe host URL. Type: string Default: https://secure.payrollintegrationsapp.com