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

</aside>

Earned wage access (EWA)

Status: Live

💡 In plain words

Normally you work all month and get paid at the end. EWA lets employees get some of the money they've already earned, before payday.

Each day, PaidHR works out how much of their salary they've earned so far. The employer chooses how much of that they can take early (for example, half). When an employee takes some, PaidHR sends it to them straight away. At the end of the month the employer pays PaidHR back, and that amount comes out of the employee's salary.

Think of it as a running tab. Every day you work, the tab grows. You can draw part of it early. On payday the tab is settled and you get the rest.

Who's involved: the employee (asks for money), the employer (sets the rules and pays the monthly bill), and PaidHR (lends the money in between and keeps track).

In one paragraph

EWA lets an employee take part of the salary they have already earned this month before payday. Every day, ewa-service credits each enrolled employee's earnings wallet with one day's share of their net pay. A company-set percentage of that becomes available to withdraw (The part of what you have earned that you are allowed to take out right now.). When the employee withdraws, the money goes to their bank account or PaidHR wallet, minus a fee. At month end the employer is invoiced (A monthly bill to the employer for everything their staff took early.) for everything their staff withdrew and recovers it from salaries through payroll. The employer settles the invoice; PaidHR has fronted the money in between.

Key ideas

Term Meaning
EWA employee / company ewa-service's own copy of the person and company, in MongoDB. Linked to core-backend by padeUserId / padeCompanyId. Created when core-backend sends create_ewa_employee or calls employees / employers/create-company
Earnings wallet Per employee, per month: totalEarnings (everything accrued) and availableBalance (what may be withdrawn)
Earning One day's credit record: amount, date, net salary that day, currency
Withdrawal percent How much of each day's earnings becomes withdrawable. Company default (50% if unset), overridden by the employee's group policy
Group policy A set of employees with their own withdrawal percent and whether withdrawals need approval
Stop day stopWithdrawalDayOfMonth: after this day withdrawals close until the next month, so payroll can recover them
Fee Charged per withdrawal, calculated per company and currency. Fee payer is the employee (taken from the amount) or the employer (added to the invoice)
Invoice Monthly bill to the employer: withdrawals plus employer-paid fees. Statuses include UNPAID, AWAITING_APPROVAL, PAID
Settlement PaidHR paying withdrawals out of its own settlement account through Paystack or Flutterwave
Earnings stopped A switch on the employee that stops accrual, set by an admin (Can stop employee earnings) or by ewa-service's own payroll-status check when payroll no longer shows the employee Active or New (for example after an exit)

How earnings accrue

Every day at 12:00 processDailyEarnings runs for every employee with earningsStopped = false and a net salary:

flowchart TB
  S[For each employee] --> C1{Company ACTIVE?}
  C1 -- no --> SKIP[Skip]
  C1 -- yes --> C2{Earnings stopped?}
  C2 -- yes --> SKIP
  C2 -- no --> C3{Payroll status Active or New?<br/>asked from core-backend}
  C3 -- no --> SKIP
  C3 -- yes --> CS[Read credit status from payroll:<br/>net pay, loans, deductions]
  CS --> BASE["Accrual base = net pay − existing deductions<br/>(capped at 10,000,000; full net salary if payroll<br/>figures can't be read)"]
  BASE --> DAY["Today's earning = base ÷ days in month"]
  DAY --> W["Earnings wallet:<br/>totalEarnings += earning<br/>availableBalance += earning × withdrawal %"]

Deactivation and reactivation

Core-backend no longer pushes exit or deactivation to ewa-service; the removed webhook that once did this is gone. Instead, whenever payroll status is checked (a withdrawal, the daily accrual job, or the nightly profile refresh below) and payroll no longer shows the employee as Active or New — for example after an exit is approved — ewa-service stops earnings and marks them INACTIVE itself, flagging the change as its own (deactivatedByPayroll). If payroll later shows the same employee Active or New again — an exit cancelled, a suspension lifted — earnings are switched back on automatically, with no one needing to re-enrol them.

This only reverses PaidHR's own deactivation. The moment HR changes an employee's status or earnings switch by hand, that flag clears, so a deliberate deactivation is never quietly undone by the next payroll check.

A nightly job, refreshEmployeeProfiles, re-checks payroll status for every employee payroll still counts as active, plus anyone ewa-service had switched off itself, so a reactivation is caught within a day even if nothing else happens to check that employee's payroll in between.

Example. Net pay ₦300,000 in a 30-day month gives ₦10,000 a day. At 50%, ₦5,000 a day becomes withdrawable. By the 10th, the employee can withdraw up to ₦50,000.