Skip to main content

Enabled ability to fetch billing plans

Category
Billing
Published

Enabled ability to fetch a list of billing plans

We're excited to announce a new feature: you can now fetch all billing plans for your application directly from our Backend API via GET /v1/commerce/plans. This gives you full flexibility to display your pricing plans however you'd like, whether it's a custom pricing page or a plan comparison chart tailed to your users.

Usage with Next.js

import { clerkClient } from '@clerk/nextjs/server'

export async function getPricingTable() {
  const client = await clerkClient()
  return client.billing.getPlanList()
}

To demonstrate what's possible in the latest Next.js versions we've put together an example that utilizes this new endpoint and renders a "cached" pricing table that is SEO-friendly and revalidates on demand.

Checkout the GitHub repo or execute the command below to clone it.

git clone https://github.com/clerk/cached-pricing-table.git
Contributors
Lamone Armstrong
Pantelis Eleftheriadis

Share this article