JA
ベータ版の翻訳

@core / billing

2.0.1 ▾
認証済みMIT
GitHub

Stripe サブスクリプション:チェックアウト、ポータル、冪等な Webhook(Drizzle)

コード9 ファイルコンテキスト約 742 トークンMCP stripeスキャン合格

.genpmignore 適用後に組み込まれる正確なツリーです。固定先:

src/lib/billing/schema.ts読み取り専用 · c2aa5da
// Tablas de @core/billing. Stripe es la fuente de verdad; aquí hay una copia sincronizada por webhooks.
import { boolean, pgTable, text, timestamp } from 'drizzle-orm/pg-core';
import { users } from '../auth/schema.ts';
import { timestamps } from '../db/index.ts';

export const billingCustomers = pgTable('billing_customers', {
  userId: text('user_id')
    .primaryKey()
    .references(() => users.id, { onDelete: 'cascade' }),
  stripeCustomerId: text('stripe_customer_id').notNull().unique(),
  ...timestamps,
});

/** Una fila por suscripción de Stripe (`sub_…`), actualizada por los webhooks `customer.subscription.*`. */
export const subscriptions = pgTable('subscriptions', {
  id: text('id').primaryKey(),
  userId: text('user_id')
    .notNull()
    .references(() => users.id, { onDelete: 'cascade' }),
  status: text('status').notNull(),
  priceId: text('price_id').notNull(),
  currentPeriodEnd: timestamp('current_period_end', { withTimezone: true, mode: 'date' }),
  cancelAtPeriodEnd: boolean('cancel_at_period_end').notNull().default(false),
  ...timestamps,
});

// `stripe_events` pasó a @core/stripe en la 2.0 (misma tabla y columnas: sin migración de datos).

export type Subscription = typeof subscriptions.$inferSelect;

@core/billing を報告

パッケージを報告するには GitHub でログインしてください。

GitHub で続ける