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: billing cancellation & details update

Blue Mouseeadd481e9463
diff --git a/web/app/pages/Billing/index.tsx b/web/app/pages/Billing/index.tsx
index fb7b975b4..42a7a2a0c 100644
--- a/web/app/pages/Billing/index.tsx
+++ b/web/app/pages/Billing/index.tsx
@@ -166,40 +166,19 @@ const Billing = () => {
})
}, [language, trialEndDate, isTrial, timeFormat, isTrialEnded, t])
- const getSafePaddleUrl = (rawUrl: unknown): string | null => {
- if (typeof rawUrl !== 'string' || rawUrl.trim().length === 0) return null
-
- let parsed: URL
- try {
- parsed = new URL(rawUrl)
- } catch {
- return null
- }
-
- if (parsed.protocol !== 'https:') return null
- if (parsed.username || parsed.password) return null
-
- // Allow only Paddle-managed hosts.
- const allowedHosts = new Set(['checkout.paddle.com', 'my.paddle.com'])
- if (!allowedHosts.has(parsed.hostname)) return null
-
- return parsed.toString()
- }
-
const onSubscriptionCancel = () => {
- const safeCancelUrl = getSafePaddleUrl(subCancelURL)
- if (!safeCancelUrl) {
+ if (!subCancelURL) {
toast.error(t('apiNotifications.somethingWentWrong'))
return
}
if (!window.Paddle) {
- window.location.replace(safeCancelUrl)
+ window.location.replace(subCancelURL)
return
}
window.Paddle.Checkout.open({
- override: safeCancelUrl,
+ override: subCancelURL,
method: 'inline',
frameTarget: 'checkout-container',
frameInitialHeight: 416,
@@ -215,19 +194,18 @@ const Billing = () => {
}
const onUpdatePaymentDetails = () => {
- const safeUpdateUrl = getSafePaddleUrl(subUpdateURL)
- if (!safeUpdateUrl) {
+ if (!subUpdateURL) {
toast.error(t('apiNotifications.somethingWentWrong'))
return
}
if (!window.Paddle) {
- window.location.replace(safeUpdateUrl)
+ window.location.replace(subUpdateURL)
return
}
window.Paddle.Checkout.open({
- override: safeUpdateUrl,
+ override: subUpdateURL,
method: 'inline',
frameTarget: 'checkout-container',
frameInitialHeight: 416,