Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

check if revenue is enabled

Blue Mouse445841accdf9
diff --git a/backend/apps/cloud/src/revenue/revenue.controller.ts b/backend/apps/cloud/src/revenue/revenue.controller.ts
index 83467c863..28ae70067 100644
--- a/backend/apps/cloud/src/revenue/revenue.controller.ts
+++ b/backend/apps/cloud/src/revenue/revenue.controller.ts
@@ -385,12 +385,22 @@ export class RevenueAnalyticsController {
): Promise<RevenueBreakdownDto> {
this.logger.log({ userId, ...dto }, 'GET /log/revenue/breakdown')
- const project = await this.projectService.getFullProject(dto.pid)
+ const project = await this.projectService.getFullProject(
+ dto.pid,
+ undefined,
+ ['stripeApiKeyEnc', 'paddleApiKeyEnc'],
+ )
if (_isEmpty(project)) {
throw new NotFoundException('Project not found')
}
+ if (!project.paddleApiKeyEnc && !project.stripeApiKeyEnc) {
+ throw new BadRequestException(
+ 'Revenue tracking is not configured for this project',
+ )
+ }
+
this.projectService.allowedToView(project, userId)
const safeTimezone = this.analyticsService.getSafeTimezone(dto.timezone)