<aside> 🔁 Synced from GitHub #c03d5885d814. Edit in the paidhr-system-docs repository, not here: changes made in Notion are overwritten.

</aside>

Payment schedules & payouts

Status: Live

💡 In plain words

Payments turn an approved payroll into money in people's bank accounts.

Each approved payroll produces a list: who gets paid, how much, and what for (salary, tax, pension and so on). After that list is approved and processed, PaidHR takes the money from the company's PaidHR wallet and sends each payment through a banking partner, then marks each one as succeeded or failed. Companies that pay through their own bank can download a bank file instead.

The payroll is the shopping list. Payments is the checkout, where money actually changes hands.

Who's involved: HR / finance (approve and process), PaidHR's wallet (sends the money), and the banking partner.

In one paragraph

A payment schedule is the list of transfers that turns an approved payroll (or a one-off batch) into money in people's accounts. Each line (payment schedule item) is one payment to one beneficiary of one type: net salary, tax, pension, HMO and so on. Schedules are approved, then processed. Processing does not call a bank: core-backend queues the items, and wallet-service debits the company wallet and pays through a banking partner, then reports each result back. Companies that do not pay through PaidHR can download bank files instead.

Key ideas

Term Meaning
Regular schedule Created from an approved payroll (Create_Regular_Payment_Schedule)
Custom schedule A one-off batch typed in or imported (Create_Custom_Payment_Schedule, Import_Custom_Payment_Schedule), with its own approval chain
Item type What the payment is: Payout (net pay), Tax, Pension, NHF, HMO, NHIS, Life assurance, NSITF, ITF, SSNIT tiers, Earned wage withdrawal, External loan repayment, Subscription, Subscription VAT
Item status 5 New · 2 Queued · 1 Succeeded · 4 Failed · 3 Reversed
Schedule status 3 New · 1 Approved · 2 Declined
Statutory schedule The tax, pension and other remittances, with files for each authority (Download_Statutory_Schedule_File)
Reversal Undo a paid item (Reverse_Payment_Schedule_Item); tracked in PaymentReversals
Split payment Pay one person into several accounts (SplitPaymentConfigSetting)
Sorting The cross-border payout-items screen can sort by amount, ascending or descending; the sort runs on the server, so it covers every page, not just the one on screen, and carries through to the CSV/Excel download

How a payout travels

sequenceDiagram
  participant HR as HR (web)
  participant Core as core-backend
  participant Stg as membership<br/>PaymentScheduleItemStaging
  participant W as ProcessQualifiedPayment worker
  participant Q as SQS payment queue
  participant Wal as wallet-service
  participant P as Banking partner
  HR->>Core: Approve schedule, then Process_Payment_Schedule
  Core->>Stg: stage qualifying items
  W->>Stg: read items not yet sent to queue
  W->>Q: publish batch (group "payments")
  W->>Stg: mark IsSentToQueue / Queued
  Q->>Wal: INITIATE_PAYOUT → PaymentService.initiatePayment
  Wal->>Wal: check wallet, PIN (not for EWA), currency blocks,<br/>charges, balance
  Wal->>P: one transfer per line (BullMQ jobs)
  P-->>Wal: webhook / requery
  Wal-->>Core: acknowledgement queue
  Core->>Core: item Succeeded or Failed,<br/>then PaymentSynchronizationService (5 min)
  Core-->>HR: employer & beneficiary notifications

What wallet-service checks before paying (initiatePayment):

  1. The wallet exists and belongs to the merchant (company).
  2. The transaction PIN is valid. EWA payouts skip this.
  3. No line is in a blocked payout currency.
  4. Charges are calculated for every line (transaction charges, stamp duty).
  5. The wallet has enough balance in each currency. If not: "insufficient balance", nothing is paid.
  6. A payment record is created, with one payment transaction per line. Each line pays as its own job.
  7. When every transaction is final, the payment is marked Completed, Partially successful or Failed.

Retrying and fixing

Action Endpoint
Retry failed lines Retry_Failed_Payment, Retry_Failed_Payments
Fix a beneficiary's details Update_Payment_Schedule_Item_Detail(s)
Reset an item to New Reset_Payment_Schedule_Item(s)
Refresh items from the latest payroll data Refresh_Payment_Schedule_Item(s)_New, Refresh_Payment_Schedule_Statutory_Items
Remove or restore a line Remove_Payment_Schedule_Item, Restore_Payment_Schedule_Item
Mark paid outside PaidHR Update_Payment_Schedule_Items (and batch versions)
Bank file Download_Bulk_Payment_Csv_File / Xls_File (with or without already-downloaded lines)