> For the complete documentation index, see [llms.txt](https://payana-saas.gitbook.io/payana-saas-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://payana-saas.gitbook.io/payana-saas-docs/produk/earned-wage-access.md).

# Earned Wage Access (Tarik Gaji Real-Time)

Earned Wage Access (EWA) adalah fitur inti Payana: karyawan bisa menarik bagian gaji yang **sudah mereka hasilkan** kapan saja, tanpa menunggu tanggal gajian.

## Bagaimana cara kerjanya

Saat HR memulai stream gaji untuk seorang karyawan (`startStream` di `CompanyVault`), kontrak mencatat `flowRate` (gaji per detik) dan `startTs` (kapan stream dimulai). Dari titik itu, saldo yang bisa ditarik karyawan bertambah terus secara linear:

```
saldo_tersedia = (waktu_sekarang - waktu_klaim_terakhir) × flowRate
```

Tidak ada "gaji bulanan" yang menumpuk lalu dicairkan sekaligus — setiap detik kerja langsung menjadi saldo yang bisa diakses.

```mermaid
sequenceDiagram
    participant K as Karyawan
    participant F as Frontend
    participant B as Backend
    participant CV as CompanyVault
    participant P as Ponder Indexer

    Note over CV: Stream berjalan terus sejak startStream()
    K->>F: Buka halaman EWA
    F->>P: Ambil flowRate & saldo terakumulasi
    P-->>F: Data stream real-time
    F-->>K: Tampilkan saldo yang bisa ditarik
    K->>F: Klik "Tarik Gaji"
    F->>B: Minta relay UserOperation (gasless)
    B->>CV: claimSalary() via bundler
    CV->>CV: Hitung & transfer IDRX ke Smart Account
    CV-->>P: Emit event SalaryClaimed
    P-->>F: Update saldo & riwayat klaim
    F-->>K: Konfirmasi gaji cair
```

## Yang membuatnya berbeda dari payroll biasa

* **Bukan pinjaman.** EWA menarik uang yang sudah menjadi hak karyawan — bukan uang muka yang harus dilunasi dengan bunga (itu fungsi [Kasbon](/payana-saas-docs/produk/kasbon.md), fitur terpisah).
* **Real-time, bukan batch.** Saldo bertambah tiap detik, bisa dicek dan ditarik kapan saja — tidak ada siklus "tutup buku" bulanan yang menahan akses.
* **Gasless.** Setiap `CompanyVault` bertindak sebagai Paymaster ERC-4337 untuk perusahaannya sendiri — karyawan tidak pernah membayar gas untuk menarik gaji mereka.
* **Transparan.** Setiap klaim tercatat sebagai event on-chain (`SalaryClaimed`), diindeks oleh `payana-indexer`, dan bisa dilihat riwayatnya kapan saja oleh karyawan maupun HR.

## Panduan penggunaan

* Karyawan: [Menarik Gaji (EWA)](/payana-saas-docs/panduan-karyawan/tarik-gaji-ewa.md)
* HR: proses stream dikelola dari halaman [Mengelola Karyawan](/payana-saas-docs/panduan-hr-and-legal/kelola-karyawan.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://payana-saas.gitbook.io/payana-saas-docs/produk/earned-wage-access.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
