unpricedPlanIsFree (plans/default-price.ts)

rekey · apps/api/src/modules/plans/default-price.ts · typescript · MIT
payments

* The one place a plan's default price is written. A plan's price is the `PlanPrice` row `Plan.defaultPriceId` names, and nowhere else. A plan with no flat price (free, or metered with no base fee) has no row, and `Plan.isFree` says which of the two it is. The plan's provider reg

// Source: https://github.com/rekey-dev/rekey | License: MIT | Copyright 2026 Rekey
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * The one place a plan's default price is written.
 *
 * A plan's price is the `PlanPrice` row `Plan.defaultPriceId` names, and
 * nowhere else. A plan with no flat price (free, or metered with no base fee)
 * has no row, and `Plan.isFree` says which of the two it is.
 *
 * The plan's provider registration (`registrationStatus`,
 * `registrationError` and the provider keys of `metadata`) is copied onto the
 * default price row in the same transaction as every plan write, because a
 * price is what a provider registers.
 */

import type { Plan, PlanPrice, Prisma } from '@prisma/client';
import { prisma } from '../../lib/prisma.js';
import 

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

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

Get a free API key