mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: add website url redirect
This commit is contained in:
parent
9591fbff08
commit
626cfb80b4
@ -1,10 +1,5 @@
|
||||
import { getStripeItems } from "@/server/utils/stripe";
|
||||
import {
|
||||
IS_CLOUD,
|
||||
findAdminById,
|
||||
findServersByAdminId,
|
||||
updateAdmin,
|
||||
} from "@dokploy/server";
|
||||
import { WEBSITE_URL, getStripeItems } from "@/server/utils/stripe";
|
||||
import { IS_CLOUD, findAdminById, findServersByAdminId } from "@dokploy/server";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
import Stripe from "stripe";
|
||||
import { z } from "zod";
|
||||
@ -72,8 +67,8 @@ export const stripeRouter = createTRPCRouter({
|
||||
metadata: {
|
||||
adminId: admin.adminId,
|
||||
},
|
||||
success_url: "http://localhost:3000/dashboard/settings/billing",
|
||||
cancel_url: "http://localhost:3000/dashboard/settings/billing",
|
||||
success_url: `${WEBSITE_URL}/dashboard/settings/billing`,
|
||||
cancel_url: `${WEBSITE_URL}/dashboard/settings/billing`,
|
||||
});
|
||||
|
||||
return { sessionId: session.id };
|
||||
@ -97,7 +92,7 @@ export const stripeRouter = createTRPCRouter({
|
||||
try {
|
||||
const session = await stripe.billingPortal.sessions.create({
|
||||
customer: stripeCustomerId,
|
||||
return_url: "http://localhost:3000/dashboard/settings/billing",
|
||||
return_url: `${WEBSITE_URL}/dashboard/settings/billing`,
|
||||
});
|
||||
|
||||
return { url: session.url };
|
||||
|
@ -1,18 +1,9 @@
|
||||
import Stripe from "stripe";
|
||||
|
||||
export const BASE_PRICE_MONTHLY_ID =
|
||||
process.env.STRIPE_BASE_PRICE_MONTHLY_ID || ""; // $4.00
|
||||
export const GROWTH_PRICE_MONTHLY_ID =
|
||||
process.env.STRIPE_GROWTH_PRICE_MONTHLY_ID || ""; // $7.99
|
||||
export const SERVER_ADDITIONAL_PRICE_MONTHLY_ID =
|
||||
process.env.STRIPE_SERVER_ADDITIONAL_PRICE_MONTHLY_ID || ""; // $3.50
|
||||
|
||||
export const BASE_PRICE_YEARLY_ID =
|
||||
process.env.STRIPE_BASE_PRICE_YEARLY_ID || ""; // $40.80
|
||||
export const GROWTH_PRICE_YEARLY_ID =
|
||||
process.env.STRIPE_GROWTH_PRICE_YEARLY_ID || ""; // $81.50
|
||||
export const ADDITIONAL_PRICE_YEARLY_ID =
|
||||
process.env.STRIPE_SERVER_ADDITIONAL_PRICE_YEARLY_ID || ""; // $35.70
|
||||
export const WEBSITE_URL =
|
||||
process.env.NODE_ENV === "development"
|
||||
? "http://localhost:3000"
|
||||
: "https://app.dokploy.com";
|
||||
|
||||
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", {
|
||||
apiVersion: "2024-09-30.acacia",
|
||||
|
Loading…
Reference in New Issue
Block a user