Fetch user subscription
- Category
- Billing
- Published
Fetch a user's subscription from the Backend API
Developers can now fetch a user's subscription directly from our Backend API via GET /user/:user_id/billing/subscription
.
Usage with Next.js
import { clerkClient, auth } from '@clerk/nextjs/server'
export async function getUserSubscription() {
const { userId } = await auth.protect()
const client = await clerkClient()
return client.billing.getUserBillingSubscription(userId)
}
For more information and SDK availability, check out the documentation.