Skip to Content
Documentation
Starter kits
Get Pro
Introduction
Installation

Billing router

An overview of the Billing router

Procedures

The billing router has the following procedures:

Get available billing plans

Returns the available billing plans that can be subscribed to.

  • Access: @public
// Client components
const { data } = useQuery(trpc.billing.plans.queryOptions())

// Server components
const data = await caller.billing.plans()

Get the billing account

Returns the billing account, containing the billing email and current subscription.

  • Access: @admin
// Client components
const { data } = useQuery(trpc.billing.account.queryOptions())

// Server components
const data = await caller.billing.account()

Update the billing account

Updates the billing email of the account and syncs the data with the billing provider (Stripe).

  • Access: @admin
// Client components
const { mutate } = useMutation(
  trpc.billing.updateBillingDetails.mutationOptions(),
)

mutate({
  input: {
    email: '',
  },
})

// Server components
const data = await caller.billing.updateBillingDetails({
  input: {
    email: '',
  },
})
Billing router