Fixes customer portal return url (#802)

pull/799/head^2
Omar López 2021-09-28 02:04:30 -06:00 committed by GitHub
parent dcea723ea4
commit f23e4f2b9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 2 deletions

View File

@ -48,7 +48,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
message: "Stripe customer id not found",
});
const return_url = `${process.env.NEXT_PUBLIC_APP_URL}/settings/billing`;
const return_url = `${process.env.BASE_URL}/settings/billing`;
const stripeSession = await stripe.billingPortal.sessions.create({
customer: customer.id,
return_url,

25
environment.d.ts vendored
View File

@ -1,5 +1,30 @@
declare namespace NodeJS {
interface ProcessEnv {
readonly CALENDSO_ENCRYPTION_KEY: string | undefined;
readonly DATABASE_URL: string | undefined;
readonly GOOGLE_API_CREDENTIALS: string | undefined;
readonly BASE_URL: string | undefined;
readonly NEXT_PUBLIC_BASE_URL: string | undefined;
readonly NEXT_PUBLIC_APP_URL: string | undefined;
readonly JWT_SECRET: string | undefined;
readonly NEXT_PUBLIC_TELEMETRY_KEY: string | undefined;
readonly MS_GRAPH_CLIENT_ID: string | undefined;
readonly MS_GRAPH_CLIENT_SECRET: string | undefined;
readonly ZOOM_CLIENT_ID: string | undefined;
readonly ZOOM_CLIENT_SECRET: string | undefined;
readonly EMAIL_FROM: string | undefined;
readonly EMAIL_SERVER_HOST: string | undefined;
readonly EMAIL_SERVER_PORT: number | undefined;
readonly EMAIL_SERVER_USER: string | undefined;
readonly EMAIL_SERVER_PASSWORD: string | undefined;
readonly CRON_API_KEY: string | undefined;
readonly NEXT_PUBLIC_STRIPE_PUBLIC_KEY: string | undefined;
readonly STRIPE_PRIVATE_KEY: string | undefined;
readonly STRIPE_CLIENT_ID: string | undefined;
readonly STRIPE_WEBHOOK_SECRET: string | undefined;
readonly PAYMENT_FEE_PERCENTAGE: number | undefined;
readonly PAYMENT_FEE_FIXED: number | undefined;
readonly CALENDSO_ENCRYPTION_KEY: string | undefined;
readonly NEXT_PUBLIC_INTERCOM_APP_ID: string | undefined;
}
}

View File

@ -12,6 +12,7 @@ if (process.env.BASE_URL) {
if (!process.env.NEXT_PUBLIC_APP_URL) {
process.env.NEXT_PUBLIC_APP_URL = process.env.BASE_URL;
}
process.env.NEXT_PUBLIC_BASE_URL = process.env.BASE_URL;
if (!process.env.EMAIL_FROM) {
console.warn(

View File

@ -13,7 +13,9 @@ export default function Billing() {
<SettingsShell>
<div className="py-6 lg:pb-8 lg:col-span-9">
<div className="my-6">
<form method="POST" action="/api/integrations/stripepayment/portal">
<form
method="POST"
action={`${process.env.NEXT_PUBLIC_BASE_URL}/api/integrations/stripepayment/portal`}>
<Button type="submit">Manage billing</Button>
</form>
</div>