Docs/Payments
💳

Payments

Collect recurring revenue from your users with Stripe-powered checkout, invoicing, and webhook handling. We manage the billing infrastructure — you define the plans.

🚧

Payment module is coming soon

The payment module is currently in development. Below is a preview of how the integration will work. You can start with authentication and subscriptions today, and add payments when the module ships.

How it will work

Define your pricing plans in the dashboard. We generate a hosted checkout page and handle Stripe webhooks to automatically update user claims when they subscribe, upgrade, or cancel.

Hosted checkout

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

Auto claim sync

When a user pays, their plan claim updates automatically.

Webhook handling

We process Stripe webhooks for you — upgrades, downgrades, cancellations, and failed payments.

Customer portal

Give users a self-serve portal to manage their subscription, update payment methods, and view invoices.

Preview: Redirect to checkout

When the payment module launches, upgrading a user will be a single redirect:

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 Stripe 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 Stripe checkout

console.log(user.claims.billing_cycle);
// "monthly" ← set by the payment module

Planned pricing tiers

You'll define your own plans, but here's a typical setup:

PlanPriceClaim value
Free$0/mo"free"
Starter$29/mo"starter"
Pro$79/mo"pro"
Scale$249/mo"scale"

Get started today

While payments are in development, you can set up auth and subscriptions now. When the payment module ships, it plugs right in.

Payments — Docs — astapa