Skip to main content

cancelSubscriptionItem()

Important

Billing regularly introduces new features and UI changes to Clerk's components. If you'd like to remain on a specific version of Clerk's components or SDK, you can follow the steps in the pinning documentation.

Cancels a Subscription Item. Returns the updated BillingSubscriptionItem.

function cancelSubscriptionItem(
  subscriptionItemId: string,
  params?: CancelSubscriptionItemParams,
): Promise<BillingSubscriptionItem>
  • Name
    endNow?
    Type
    boolean
    Description

    If true, the Subscription Item will be canceled immediately. If false or omitted, it will be canceled at the end of the current billing period.

Note

Using clerkClient varies based on the SDK you're using. Refer to the overview for usage details, including guidance on how to access the userId and other properties.

const response = await clerkClient.billing.cancelSubscriptionItem('subi_123', { endNow: true })

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint DELETE /billing/subscription_items/{id}. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on