Docs/Payments

Payments

Collect recurring revenue from your users with hosted checkout, automatic plan sync, and webhook handling. You define the plans — we manage the billing infrastructure.

Hosted plan selection is live
When you define plans in your project dashboard, end users automatically see a plan selection page after login. They pick a plan, the plan claim is set in their JWT, and they're redirected to your app. No code changes needed.

What's available now

Plan selection works today without payment processing — perfect for freemium models, trials, and beta launches. Users choose a tier, the claim is set, and your app gates features accordingly.

Plan selection

Hosted page after login, auto-sets the plan claim

JWT claims

Plan tier embedded in every access token

API assignment

Set plans programmatically from your backend

Coming soon: hosted checkout

Full payment processing is in development. When it ships, upgrading a user will be a single redirect — no payment code in your app.

Hosted checkout

Redirect users to a branded checkout page. No payment processing code in your app.

Auto claim sync

When a user pays, their plan claim updates automatically.

Webhook handling

We process payment webhooks — upgrades, downgrades, cancellations, failed payments.

Customer portal

Self-serve portal for users to manage subscriptions, update payment methods, view invoices.

Preview: checkout redirect

When the payment module launches, upgrading a user will look like this:

upgrade.tstypescript
// Redirect user to hosted checkout
const checkoutUrl = "https://astapa.com/checkout";
const params = new URLSearchParams({
  project_id: "your_project_id",
  plan: "pro",
  user_id: currentUser.id,
  success_url: "https://yourapp.com/welcome",
  cancel_url: "https://yourapp.com/pricing",
});

window.location.href = `${checkoutUrl}?${params}`;

Preview: automatic plan sync

After checkout, we handle the payment webhook and update the user's claims. Your app just reads the token — no webhook code needed.

your-app.tstypescript
// After payment, the user's token automatically includes the new plan
const user = verifyToken(access_token);

console.log(user.claims.plan);
// "pro" ← updated automatically after checkout

console.log(user.claims.billing_cycle);
// "monthly" ← set by the payment module
Backward compatible
When payments ship, everything you've built with plan selection and claims continues to work. Payments just automate the claim assignment that you're currently doing manually or via API.

Get started today

Set up auth and plans now. When the payment module ships, it plugs right in.

API Playground
Click "Try it" on any endpoint to get started.
Payments | Astapa