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!

fix: incorrect trial charging

Blue Mouse471f29b3dadc
diff --git a/backend/apps/cloud/src/user/user.service.ts b/backend/apps/cloud/src/user/user.service.ts
index 8cab7f517..2d06798f8 100644
--- a/backend/apps/cloud/src/user/user.service.ts
+++ b/backend/apps/cloud/src/user/user.service.ts
@@ -571,13 +571,20 @@ export class UserService {
let result: any = {}
try {
+ const isTrial = !user.trialEndDate
+
result = await axios.post(url, {
vendor_id: Number(PADDLE_VENDOR_ID),
vendor_auth_code: PADDLE_API_KEY,
product_id: productId,
customer_email: user.email,
passthrough: JSON.stringify({ uid: id }),
- ...(user.trialEndDate ? {} : { trial_days: TRIAL_DURATION }),
+ ...(isTrial
+ ? {
+ trial_days: TRIAL_DURATION,
+ prices: ['USD:0', 'EUR:0', 'GBP:0'],
+ }
+ : {}),
})
} catch (error) {
console.error(