Documentation
Both live services are plain HTTPS + JSON APIs authenticated with a per-app API key (Authorization: Bearer <key>). Keys are server-side only. We ship a single-file, dependency-free TypeScript client for each that runs on Cloudflare Workers, Node 20+, Deno and Bun.
Authentication
An OAuth 2.0 authorization-code flow with PKCE. Your app redirects the user to Passin's hosted sign-in page; Passin returns a one-time code to your callback; your server exchanges it for the user.
| Endpoint | What it does |
|---|---|
GET /authorize | Hosted sign-in / sign-up page (email + password, emailed code, Google, GitHub) |
POST /v1/token | Exchange the code for the user, session ID and membership |
GET /v1/users/{id} | Read a user (by ID or ?email=) |
GET /v1/sessions/{id}, POST …/revoke | Check or end a sign-in session |
POST /v1/mail | Send a transactional email from your app's domain |
GET /v1/events | Event log; the same events are pushed to your webhook |
Webhook events (HMAC-SHA256 signed, retried with back-off): user.updated, user.disabled, user.enabled, user.deleted, session.revoked, mail.bounced, mail.complained.
const passin = createPassinClient({ appId: "my_app", apiKey: env.PASSIN_API_KEY });
// sign-in route
return (await passin.beginLogin({ redirectUri })).response;
// callback route
const r = await passin.completeLogin(request, { redirectUri });
if (r.ok) { /* find or create your user by r.user.id, start your session */ }
Payments
One order API in front of the providers you connect. Amounts are integers in the currency's minor unit.
| Endpoint | What it does |
|---|---|
GET /v1/channels | Payment methods available to your app right now |
POST /v1/orders | Create an order; returns a hosted checkout URL or a QR code |
GET /v1/orders/{id} | Order status (optionally re-checked with the provider) |
POST /v1/orders/{id}/close | Cancel an unpaid order |
POST /v1/orders/{id}/refund | Full or partial refund |
Webhook events: order.paid, order.closed, order.refunded. Signed, retried for up to three days, idempotent by order reference.
const order = await pay.createOrder({ ref: "inv_1042", channel: "stripe_checkout", amount: 1900, currency: "USD",
title: "Pro plan", customer_ref: user.id, return_url: "https://example.com/billing/done" });
// redirect the buyer to order.pay_url
Access
API keys are issued during onboarding. Email contact@passin.io with what you are building; the full reference and client libraries are shared with your keys.