Skip to content
Systems

Billing

Billing connects payments to the rest of your application. Plans carry entitlements, so code asks whether a customer may export a PDF rather than which price they pay, and what a plan includes can change without a deploy. Funds settle to your own merchant account; Dianthan takes no share of revenue.

What Billing does

Checkout and the customer portal

Hosted checkout and a self-service billing portal, already tied to the signed-in user or their organization.

Entitlements instead of price IDs

Features and limits live on plans. One call returns what the current user is allowed to do, and it already sits in their session.

A ledger you can read

Customers, subscriptions and invoices are recorded from verified payment events, applied exactly once, and queryable without a round trip to the processor.

People or teams

Bill an individual or an organization. Cancel and resume from your own interface or from the portal.

Grants and overrides

Grant a plan, extend a trial, or enable a single feature for one account, without touching payment configuration.

Your own merchant accountIn preview

Connect your merchant account from the dashboard, so every charge settles directly to you.

In your code.

Gate a feature on the plan, not on a price.

TypeScript
const { entitlements } = await dianthan.me.entitlements(session);

if (!entitlements["export.pdf"]) {
  const { url } = await dianthan.billing.checkout(session, {
    plan: "pro",
    successUrl: "https://fieldnotes.app/export",
  });
  return redirect(url);
}

Better with.

What Billing does once another system is switched on in the same app.

  • Identity

    Checkout already knows who is paying, and entitlements arrive with the session.

  • Metering

    Plans carry quotas, and usage counts against them as it happens.

  • Flags

    Roll a feature out to one plan before you put it on the pricing page.

  • Messaging

    Receipts, failed-payment notices and trial reminders go out without extra code.

  • Models

    Each customer's model cost is set against what they paid, so you can see who you lose money on.

Endpoints.

The main routes. The API reference lists every parameter and response.

  • POST /v1/billing/checkout
  • POST /v1/billing/portal
  • GET /v1/billing/plans
  • GET /v1/billing/subscriptions
  • POST /v1/billing/subscriptions/:id/cancel
  • GET /v1/billing/invoices
  • GET /v1/me/entitlements
  • GET /v1/organizations/:id/entitlements

Included in the plan.

Billing is part of every account: free within hard limits, then included in the $29 plan that covers every system and every app.

  • Included

    Unlimited plans and customers. Payment events and ledger. No share of your revenue.

  • Beyond that

    Nothing. Card processing fees still apply.