Add usage checker

This commit is contained in:
Bill Yang 2025-03-13 22:15:10 -07:00
parent db06705649
commit 3b05aa6757
8 changed files with 302 additions and 89 deletions

View file

@ -4,7 +4,7 @@ import dotenv from "dotenv";
import pg from "pg";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { db } from "../db/postgres/postgres.js";
import { IS_CLOUD } from "./const.js";
import { IS_CLOUD, STRIPE_PLANS } from "./const.js";
import * as schema from "../db/postgres/schema.js";
import { eq } from "drizzle-orm";
import { stripe } from "@better-auth/stripe";
@ -31,89 +31,7 @@ const pluginList = IS_CLOUD
createCustomerOnSignUp: true,
subscription: {
enabled: true,
plans: [
{
priceId: "price_1R1fIVDFVprnAny2yJtRRPBm",
name: "basic100k",
interval: "month",
limits: {
events: 100_000,
},
},
{
priceId: "price_1R1fKJDFVprnAny2mfiBjkAQ",
name: "basic250k",
interval: "month",
limits: {
events: 250_000,
},
},
{
name: "basic500k",
priceId: "price_1R1fQlDFVprnAny2WwNdiRgT",
interval: "month",
limits: {
events: 500_000,
},
},
{
name: "basic1m",
priceId: "price_1R1fR2DFVprnAny28tPEQAwh",
interval: "month",
limits: {
events: 1_000_000,
},
},
{
name: "basic2m",
priceId: "price_1R1fRMDFVprnAny24AMo0Vuu",
interval: "month",
limits: {
events: 2_000_000,
},
},
{
name: "pro100k",
priceId: "price_1R1fRmDFVprnAny27gL7XFCY",
interval: "month",
limits: {
events: 100_000,
},
},
{
name: "pro250k",
priceId: "price_1R1fSADFVprnAny2d7d4tXTs",
interval: "month",
limits: {
events: 250_000,
},
},
{
name: "pro500k",
priceId: "price_1R1fSkDFVprnAny2MzBvhPKs",
interval: "month",
limits: {
events: 500_000,
},
},
{
name: "pro1m",
priceId: "price_1R1fTMDFVprnAny2IdeB1bLV",
interval: "month",
limits: {
events: 1_000_000,
},
},
{
name: "pro2m",
priceId: "price_1R1fTXDFVprnAny2JBLVtkIU",
interval: "month",
limits: {
events: 2_000_000,
},
},
],
plans: STRIPE_PLANS,
},
}),
]