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 the given Subscription Item.

Returns the cancelled BillingSubscriptionItem object.

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

    The ID of the Subscription Item to cancel.

  • Name
    params?
    Type
    { endNow?: boolean; }
    Description

    The parameters for the request.

  • Name
    params?.endNow?
    Type
    boolean
    Description

    Whether the Subscription Item should be canceled immediately. If false, the Subscription Item 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