API reference (v1)
Base URL: your deployment's PUBLIC_BASE_URL. JSON in and out.
- Auth:
Authorization: Bearer sk_test_…(secret key, server-side only). Basic auth with the key as username also works. - Modes: test keys use the testnet; live keys use mainnet. Objects carry
livemode. - Idempotency: send
Idempotency-Keyon POSTs. The same key and body replays the stored response (headeridempotent-replayed: true). The same key with a different body returns409. - Pagination:
limit(1–100) andstarting_after=<id>. Responses look like{ object: "list", data, has_more }. - Errors:
{ "error": { "type", "code", "message", "param?" } }. Statuses: 400 / 401 / 402 (account past due, orplan_limit_reached: monthly order cap used) / 403 / 404 / 409 / 429 / 5xx. - Rate limits: per key and per IP (default 300/min).
Money rules: amount is in fiat minor units (cents: 2500 = 25.00). amount_token is in token base units (6 decimals for USDC/USDT). Merchants always receive 100%; our fees are invoiced separately.
Payments
| Method | Path | Notes |
|---|---|---|
| POST | /v1/payments | amount, currency (USD|KES), optional order_id, description, success_url, cancel_url, token (USDC|USDT), metadata (string map). Returns id, checkout_url, expires_at (rate locked for 15 min). |
| GET | /v1/payments/:id | |
| GET | /v1/payments | Filters: status, order_id. |
| POST | /v1/payments/:id/cancel | Only created / pending_approval. |
Statuses: created → pending_approval (buyer asked to approve on their phone) → submitted → paid \| expired \| cancelled \| failed; later refunded / partially_refunded. Only the blockchain watcher sets paid.
Flags:
| Flag | Meaning |
|---|---|
underpaid | Less than amount_token arrived; not paid yet. |
overpaid | Paid, plus extra (refund the difference). |
duplicate | Paid again after already being paid. |
duplicate_order | Another payment for the same order_id was also paid. |
late | Paid after expiry or cancellation; the money is in your wallet. |
kind is one of checkout, link, subscription or invoice.
Checkout sessions (Stripe-style)
| Method | Path | Notes |
|---|---|---|
| POST | /v1/checkout/sessions | Same body as POST /v1/payments (JSON or form-encoded). Returns { id, object: "checkout.session", url, payment_status, amount_total, currency, expires_at, explorer_url }. |
| GET | /v1/checkout/sessions/:id | payment_status: unpaid → paid (or expired / cancelled). |
Browser side: <script src="https://pryvpay.co/checkout.js" data-key="pk_…"> then Checkout.open({ sessionId, onSuccess, onCancel }). This opens a modal on desktop (framing is allowed only from your registered site domain) and the full-page checkout on mobile. pay.js / Pay.checkout keep working too.
Each payment includes explorer_url (block-explorer link for tx_hash) when the network has an explorer configured.
Refunds
Refunds are sent from your own wallet, so each refund needs your approval in the dashboard. You approve with your passkey wallet, or send from your external wallet.
| Method | Path | Notes |
|---|---|---|
| POST | /v1/refunds | payment, optional amount_token (base units; default = everything still refundable), reason. Returns status: pending_approval and approval_url. |
| GET | /v1/refunds/:id | pending_approval → submitted → sent (confirmed on-chain) | cancelled. |
| GET | /v1/refunds | Filter: payment. |
Buyers can ask for a refund from their wallet receipt. You get a refund.requested webhook and the request appears in Dashboard → Refunds, with a one-click Refund buyer button (the buyer's paying wallet and exact amount are filled in).
Payment links
| Method | Path | Notes |
|---|---|---|
| POST | /v1/payment_links | amount, currency, description. Returns a shareable url (/l/…). Each visit creates a fresh payment. |
| GET | /v1/payment_links | |
| POST | /v1/payment_links/:id/deactivate |
Subscriptions
| Method | Path | Notes |
|---|---|---|
| POST | /v1/subscriptions | amount, currency, interval (day|week|month|year), optional description, customer_reference, token, success_url, cancel_url, metadata. Returns approval_url: send the buyer there. |
| GET | /v1/subscriptions/:id, /v1/subscriptions | Statuses: pending → active | past_due → cancelled. |
| POST | /v1/subscriptions/:id/cancel | Stops future charges immediately. Buyers cancel on-chain from their wallet. |
How it works: the buyer's wallet approves a capped amount per period once (cap, which includes a 10% exchange-rate buffer). Our scheduler charges each period at the live rate, paid buyer → merchant directly. Failed charges retry after 1, 2 and 4 days, then stay past_due. Before the first charge, enable automatic charges once in Dashboard → Subscriptions.
Account
| Method | Path | Notes |
|---|---|---|
| GET | /v1/merchant | Your settings. |
| GET | /v1/webhook_deliveries | Recent deliveries. |
| POST | /v1/webhook_deliveries/:id/resend | |
| GET | /v1/invoices | SaaS plan and order-credit invoices (our fees; never a percentage of payments). |
Checkout & wallet (public; used by the hosted pages and the buyer's wallet)
| Method | Path | Notes |
|---|---|---|
| GET | /checkout/:id | Hosted checkout (strict CSP, no third-party scripts). |
| GET | /v1/checkout/:id | Public payment data + wallet calls. No metadata or buyer PII. |
| GET | /v1/checkout/:id/status | JSON, or SSE with Accept: text/event-stream. |
| POST | /v1/checkout/:id/login | {method:"passkey"} returns WebAuthn options; {handle} sends an approval request to the buyer's phone. |
| POST | /v1/checkout/:id/approve-request | {handle}: email, phone or @username → request appears in the buyer's wallet (plus a push notification). Returns approval_id. |
| POST | /v1/checkout/:id/approval-code | {approval_id, code}: the 6-digit code the wallet shows after the buyer approves. The signed payment is only sent once this matches (5 tries, valid 5 minutes). |
| POST | /v1/checkout/:id/token, /requote, /precheck, /submitted | Token switch, fresh quote, sanctions/balance precheck, tx report (informational). |
| POST | /v1/wallet/otp, /v1/wallet/register/options, /v1/wallet/register | Verified phone/email + passkey → smart wallet. |
| POST | /v1/wallet/login/options, /v1/wallet/login | Passkey login. |
| GET | /v1/wallet/me, /balance, /history, /approvals, /subscriptions, /devices, /guardians | Buyer session. |
| GET | /v1/resolve/:handle | Phone/username → address (for Send). |
| POST | /v1/wallet/userops/prepare, /v1/wallet/userops/:hash/submit | Server prepares + sponsors gas; the passkey signs on the device; server submits. |
| POST | /v1/wallet/devices/link/options, /v1/wallet/devices/link | Add a device (approved from an existing device). |
| POST | /v1/wallet/recovery/options, /v1/wallet/recovery, /v1/wallet/recovery/:id/execute | Guardian / backup-key recovery. |
| POST | /v1/wallet/topup | Opens the licensed partner's top-up. |
| GET | /v1/wallet/purchases | Store receipts (store, order, amount, tx + explorer link). |
| POST | /v1/wallet/purchases/:id/refund-request | { message? }: notifies the merchant with the buyer's paying wallet. |
| GET | /v1/wallet/signers | On-chain owners (passkeys + recovery-phrase key). |
| GET | /v1/wallet/cash-links, /v1/wallet/cash-links/by-tx/:tx | Cash links sent by this wallet. |
| GET | /v1/cash-links/:id | Public: amount, token, status of a cash link. |
| POST | /v1/cash-links/:id/claim | { to, signature }: relays a claim signed with the link's key (the signature fixes the recipient). |
Admin (Authorization: Bearer $ADMIN_TOKEN; the admin UI is at /admin)
POST|GET /admin/merchants, PATCH /admin/merchants/:id, POST /admin/merchants/:id/rotate-keys, GET /admin/payments?status=&flag=, GET /admin/transfers?match_status=unmatched, GET|POST /admin/blocklist, DELETE /admin/blocklist/:id, POST /admin/webhook_deliveries/:id/resend, GET /admin/audit, GET /admin/health.