Fixes customer portal return url (#802)
This commit is contained in:
parent
dcea723ea4
commit
f23e4f2b9d
4 changed files with 30 additions and 2 deletions
|
@ -48,7 +48,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
message: "Stripe customer id not found",
|
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({
|
const stripeSession = await stripe.billingPortal.sessions.create({
|
||||||
customer: customer.id,
|
customer: customer.id,
|
||||||
return_url,
|
return_url,
|
||||||
|
|
25
environment.d.ts
vendored
25
environment.d.ts
vendored
|
@ -1,5 +1,30 @@
|
||||||
declare namespace NodeJS {
|
declare namespace NodeJS {
|
||||||
interface ProcessEnv {
|
interface ProcessEnv {
|
||||||
readonly CALENDSO_ENCRYPTION_KEY: string | undefined;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ if (process.env.BASE_URL) {
|
||||||
if (!process.env.NEXT_PUBLIC_APP_URL) {
|
if (!process.env.NEXT_PUBLIC_APP_URL) {
|
||||||
process.env.NEXT_PUBLIC_APP_URL = process.env.BASE_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) {
|
if (!process.env.EMAIL_FROM) {
|
||||||
console.warn(
|
console.warn(
|
||||||
|
|
|
@ -13,7 +13,9 @@ export default function Billing() {
|
||||||
<SettingsShell>
|
<SettingsShell>
|
||||||
<div className="py-6 lg:pb-8 lg:col-span-9">
|
<div className="py-6 lg:pb-8 lg:col-span-9">
|
||||||
<div className="my-6">
|
<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>
|
<Button type="submit">Manage billing</Button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue