Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: either allow discount or promo codes

Marc Seitzd5b5a578d0db
diff --git a/pages/api/teams/[teamId]/billing/upgrade.ts b/pages/api/teams/[teamId]/billing/upgrade.ts
index b18cd690..9d52d7a2 100644
--- a/pages/api/teams/[teamId]/billing/upgrade.ts
+++ b/pages/api/teams/[teamId]/billing/upgrade.ts
@@ -6,7 +6,7 @@ import { waitUntil } from "@vercel/functions";
import { getServerSession } from "next-auth/next";
import { identifyUser, trackAnalytics } from "@/lib/analytics";
-import { dub, getDubDiscountForExternalUserId } from "@/lib/dub";
+import { getDubDiscountForExternalUserId } from "@/lib/dub";
import prisma from "@/lib/prisma";
import { CustomUser } from "@/lib/types";
@@ -114,9 +114,8 @@ export default async function handle(
enabled: true,
},
mode: "subscription",
- allow_promotion_codes: true,
client_reference_id: teamId,
- ...(dubDiscount ?? {}),
+ ...(dubDiscount ?? { allow_promotion_codes: true }),
metadata: {
dubCustomerId: userId,
},