Developer docs
Build private payments into your app.
The pagor HTTP API is live in v1. Create a private payment link, prepare a payroll run, or issue a signed disclosure proof. Settlement is public. The amount is not.
/static/sdk/pagor.js. It is a thin source wrapper, not a package registry release. MCP and CLI are planned on the same primitives.Quickstart
Create a private link with one request. Amounts are integers in the smallest unit of the asset: satoshis for BCH, cents for PUSD.
curl -X POST http://localhost:8080/api/links \
-H 'Content-Type: application/json' \
-d '{"amount":25000,"token":null,"note":"Invoice 42"}'
201 response
{
"id": "L_...",
"claimUrl": "/l/L_...",
"address": "bitcoincash:...",
"status": "open"
}
Share claimUrl. The payer opens it, sees the amount, and pays from any BCH wallet. The chain sees a settlement, not the invoice.
Authentication
Google Identity Services returns an ID token to the browser. Exchange it for an pagor session token. Send that token as a bearer header on account calls.
POST /api/auth/google
{ "idToken": "<google credential>" }
Authorization: Bearer <pagor session token>
The server verifies the Google token, checks the audience and verified email, then returns a session token. No cookie is set. The client stores the token in localStorage.
Endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | /api/health | Service status |
| GET | /api/config | Google client ID and receiving addresses |
| POST | /api/auth/google | Verify a Google ID token and create a session |
| GET | /api/me | Current account (bearer token) |
| POST | /api/logout | Delete the session (bearer token) |
| GET | /api/notifications | Account notifications |
| POST | /api/assistant | Rules-based in-app guide |
| POST | /api/links | Create a private payment link |
| GET | /api/links/{id} | Read link state |
| POST | /api/payroll/upload | Parse a payroll CSV (multipart field csv) |
| GET | /api/payroll/{id} | Read a payroll plan |
| POST | /api/disclose | Create a signed disclosure proof |
| GET | /api/proofs/{id} | Read a proof |
Payroll
Upload a CSV with exactly three columns. Amounts are integers in the smallest unit. The response is a draft run with a review URL; nothing is sent by uploading. Addresses below are shortened.
name,address,amount Ada,bitcoincash:qexample,125000 Grace,bitcoincash:pexample,98000
201 response
{ "id": "PR_...", "rows": 2, "total": 223000, "reviewUrl": "/payroll/PR_..." }
Disclosure proofs
A proof is a signed statement that a subject meets a threshold until an expiry date. It is not a zero-knowledge proof. The verifier learns the threshold, the subject and the expiry, never the balance.
POST /api/disclose
{ "subject": "Lender X", "threshold": 1000000, "expiresInDays": 30 }
201 response
{ "id": "DP_...", "proof": "...", "verifyUrl": "/proof/DP_..." }
Source client
The v1 client mirrors the endpoints: createLink, getLink, submitPayroll, getPayroll, createProof, getProof, me and logout.
import { PagorClient } from '/static/sdk/pagor.js'
const pagor = new PagorClient({
baseUrl: location.origin,
token: localStorage.getItem('edj_session')
})
const link = await pagor.createLink({ amount: 25000, note: 'Invoice 42' })
console.log(link.claimUrl)
Errors and limits
Errors use one shape and one HTTP status. The prototype keeps state in memory, so links, payroll runs and proofs reset when the server restarts. Nothing here is a promise of mainnet custody.
{ "error": { "code": "ERROR", "message": "invalid amount" } }
Payroll uploads are limited to 8 MB. Amounts must be positive integers. Proofs default to 30 days when no expiry is supplied.