Skip to content
⌘K
InboxAsk a human

How do I detect when a Switch Kit / Bill Switch flow has completed events / callbacks?

Updated by Wendy

There are two ways to detect completion: client-side Link events for real-time UI feedback, and server-side webhooks as the authoritative record. We recommend using webhooks as your source of truth, since the client-side events can be missed if a user closes the browser or app before the event fires.

Client-side (Link SDK events/callbacks):

  • The onSuccess callback fires once for each job that completes successfully. Its payload includes a job field telling you which job completed (for example direct_deposit_switch).

  • If you use the more granular onEvent callback (or the equivalent specialized callbacks), you'll see a success event for each completed direct deposit switch, and bill_switch_success / bill_switch_failure events for each individual bill switch attempt.

  • The exit event fires when the user closes the modal, with error details included if the session ended because of an error.

  • Because a single Switch Kit session can include both a direct deposit switch and one or more bill switches, you may receive multiple success and/or bill_switch_success events within one session — one per completed job.

Server-side (webhooks) — the authoritative source:

  • Subscribe to account.added (fires once the user successfully logs into the payroll platform or merchant), direct_deposit_switch.added (fires once a deposit switch completes), and bill_switch.added (fires once a bill switch completes).

  • These fire from Pinwheel's backend once the job is confirmed, independent of whether the client-side event was received, so they're the reliable way to know a switch actually completed.

In practice, most integrations use the client-side events to update the UI in real time, and the webhooks to update their own system of record. See Pinwheel's Link Events guide and Webhooks guide for full payload details, and the Switch Kit implementation guide for the Switch-Kit-specific webhook examples.