Web apps
Paylo isn't only for mobile. Any web app — SaaS, a web game, a plain website — can sell subscriptions and one-time purchases with the same REST API. There's no SDK to install: you create a checkout, redirect the browser to it, and the customer lands back on your site when they're done.
How it works on the web#
The mobile SDKs are convenience wrappers; on the web you talk to the API directly. The whole integration is three steps and no polling:
Your web app / backend
│ POST /v1/subscriptions (or /v1/sessions)
▼
Paylo API ──▶ returns a hosted checkout "url"
│ window.location.href = url
▼
Branded Stripe checkout (paylo domain)
│ payment complete
▼
Browser redirected to your success_url + webhook to your server1. Create the checkout#
/v1/subscriptionsPass a success_url and cancel_url so the customer comes back to your site — these are what make the web flow round-trip. They fall back to the defaults you set in Settings.
| Field | Type | Description |
|---|---|---|
plan_idrequired | string | Plan slug or UUID |
customer_idrequired | string | YOUR user id — anything stable |
customer_email | string | Pre-fills the checkout email field |
success_url | string | Where the browser returns after payment |
cancel_url | string | Where the browser returns if they back out |
Lifetime access is a one_time plan sold through this same endpoint. Other one-off purchases your server fulfils itself (credit packs…) go through POST /v1/sessions.
2. Redirect the browser#
Take the url from the response and send the customer there. From your backend (Node shown — any language works):
async function startCheckout(user) {
const res = await fetch(
"https://paylo-production.up.railway.app/v1/subscriptions",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PAYLO_SECRET_KEY}`, // sk_live_…
"Content-Type": "application/json",
},
body: JSON.stringify({
plan_id: "pro_monthly",
customer_id: user.id,
customer_email: user.email,
success_url: "https://yourapp.com/welcome",
cancel_url: "https://yourapp.com/pricing",
}),
}
);
const { url } = await res.json();
return url; // redirect the browser there → branded checkout, then back to success_url
}sk_…) — never put a secret key in a web page. It keeps success_url under your control and lets you set an Idempotency-Key against double-submits.3. Grant access when they come back#
Two signals tell you the payment went through — use whichever fits your stack:
- The webhook — the source of truth. Paylo fires an HMAC-signed
subscription.activated/payment.completedto your server the moment Stripe confirms. Flip the user to premium there. See Webhooks. - The status check — on the page your
success_urlloads, have your server callGET /v1/customers/:id/statusto readhas_active_subscriptionand entitlements. Same endpoint the mobile apps use for gating.
/v1/customers/:customerId/statussuccess_url redirect alone — a URL can be visited without paying. Confirm with the webhook or a status check before granting access.Paywalls & pricing pages#
The remotely configured native paywallsrender on Flutter and SwiftUI — they're a mobile feature. On the web you build your own pricing page and start a checkout from it. Fetch your live plans (prices, intervals, trials, entitlements) with GET /v1/plans so the page stays in sync with the dashboard, then call the flow above when a visitor picks a plan. Everything else — free trials, the customer portal, refunds, test/live modes — behaves identically to mobile.