cancelWorkspaceSubscription (src/subscription-cancellation.ts)

intelligo · packages/billing/src/subscription-cancellation.ts · typescript · Apache-2.0
payments

Cancels a workspace's Stripe subscription immediately, handling missing or already canceled cases.

// Source: https://github.com/intelligo-dev/intelligo | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Ending a workspace's Stripe subscription when the workspace is deleted.
 * Takes a resolved `workspaceId`; the caller has already checked that its
 * user may delete the workspace.
 */

import { getStripe } from "./stripe";
import { getWorkspaceBilling } from "./queries";

/**
 * End a workspace's Stripe subscription at once. For a workspace about
 * to be deleted: its `subscriptions` row goes with it, and Stripe would
 * keep charging the customer for a workspace nobody can reach. A
 * workspace with no live Stripe subscription is left as it is.
 */
export async function c

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key