Add Lemon Squeezy Billing System

This commit is contained in:
giancarlo
2024-04-01 21:43:18 +08:00
parent 84a4b45bcd
commit 8784a40a69
59 changed files with 424 additions and 74 deletions

View File

@@ -0,0 +1,15 @@
import { z } from 'zod';
export const StripeClientEnvSchema = z
.object({
publishableKey: z.string().min(1),
})
.refine(
(schema) => {
return schema.publishableKey.startsWith('pk_');
},
{
path: ['publishableKey'],
message: `Stripe publishable key must start with 'pk_'`,
},
);

View File

@@ -0,0 +1,25 @@
import { z } from 'zod';
export const StripeServerEnvSchema = z
.object({
secretKey: z.string().min(1),
webhooksSecret: z.string().min(1),
})
.refine(
(schema) => {
return schema.secretKey.startsWith('sk_');
},
{
path: ['STRIPE_SECRET_KEY'],
message: `Stripe secret key must start with 'sk_'`,
},
)
.refine(
(schema) => {
return schema.webhooksSecret.startsWith('whsec_');
},
{
path: ['STRIPE_WEBHOOK_SECRET'],
message: `Stripe webhook secret must start with 'whsec_'`,
},
);