Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
feat: stripe lockdown webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Sep 3, 2023
1 parent 5e3fb16 commit a52d758
Show file tree
Hide file tree
Showing 11 changed files with 615 additions and 361 deletions.
1 change: 1 addition & 0 deletions .env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ ADMIN_USERS="eddiejaoude,SaraJaoude"
STRIPE_SECRET_KEY=""
STRIPE_PREMIUM_PRICING_ID=""
STRIPE_MANAGE_PLAN_URL=""
STRIPE_WEBHOOK_SECRET=""
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ ADMIN_USERS="eddiejaoude,SaraJaoude,_test-admin-user"
STRIPE_SECRET_KEY=""
STRIPE_PREMIUM_PRICING_ID=""
STRIPE_MANAGE_PLAN_URL=""
STRIPE_WEBHOOK_SECRET=""
5 changes: 4 additions & 1 deletion components/account/manage/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ const tabs = [
{
name: "Links",
href: "/account/manage/links",
match: ["/account/manage/link/[[...data]]"],
match: [
"/account/manage/link/[[...data]]",
"/account/statistics/link/[[...data]]",
],
icon: MdOutlineLink,
current: false,
},
Expand Down
2 changes: 2 additions & 0 deletions config/schemas/serverSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const envSchema = z.object({
GITHUB_API_TOKEN: z.string().optional(),
RANDOM_USERS: z.string().optional(),
ADMIN_USERS: z.string().optional(),
NEXT_PUBLIC_VERCEL_ENV: z.string().optional(),
STRIPE_SECRET_KEY: z.string().optional(),
STRIPE_WEBHOOK_SECRET: z.string().optional(),
});

const serverEnv = envSchema.safeParse(process.env);
Expand Down
13 changes: 13 additions & 0 deletions config/stripe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Stripe from "stripe";

import { serverEnv } from "@config/schemas/serverSchema";

const stripe = () => {
const stripe = new Stripe(serverEnv.STRIPE_SECRET_KEY, {
apiVersion: "2020-08-27",
});

return stripe;
};

export default stripe();
Loading

0 comments on commit a52d758

Please sign in to comment.