Skip to content

Commit 5048624

Browse files
Sai Sridhar Tarraclaude
authored andcommitted
Fix: rename stripe_subscription_id → subscription_id in code and types
Run in Supabase SQL editor: ALTER TABLE user_profiles ADD COLUMN IF NOT EXISTS subscription_id TEXT; Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7d63316 commit 5048624

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

backend/services/razorpay_service.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async def create_subscription(user_id: str, plan_id: str, email: str = "") -> st
7474
# Store the pending subscription ID so the webhook can update it later
7575
supabase = get_supabase()
7676
supabase.table("user_profiles").update(
77-
{"stripe_subscription_id": subscription["id"]}
77+
{"subscription_id": subscription["id"]}
7878
).eq("id", user_id).execute()
7979

8080
return short_url
@@ -151,7 +151,7 @@ async def _handle_subscription_activated(subscription: dict) -> None:
151151

152152
supabase = get_supabase()
153153
supabase.table("user_profiles").update(
154-
{"plan": plan_name, "stripe_subscription_id": sub_id}
154+
{"plan": plan_name, "subscription_id": sub_id}
155155
).eq("id", user_id).execute()
156156

157157
logger.info("User %s activated plan=%s (Razorpay sub=%s)", user_id, plan_name, sub_id)
@@ -164,7 +164,7 @@ async def _handle_subscription_deactivated(subscription: dict) -> None:
164164
result = (
165165
supabase.table("user_profiles")
166166
.select("id")
167-
.eq("stripe_subscription_id", sub_id)
167+
.eq("subscription_id", sub_id)
168168
.single()
169169
.execute()
170170
)
@@ -188,14 +188,14 @@ async def get_subscription_status(user_id: str) -> dict:
188188
supabase = get_supabase()
189189
result = (
190190
supabase.table("user_profiles")
191-
.select("plan, stripe_subscription_id")
191+
.select("plan, subscription_id")
192192
.eq("id", user_id)
193193
.single()
194194
.execute()
195195
)
196196
profile = result.data or {}
197197
plan = profile.get("plan", "free")
198-
subscription_id = profile.get("stripe_subscription_id")
198+
subscription_id = profile.get("subscription_id")
199199

200200
now = datetime.now(timezone.utc)
201201
month_start = now.replace(
@@ -217,7 +217,7 @@ async def get_subscription_status(user_id: str) -> dict:
217217
"current_plan": plan,
218218
"plan_details": PLAN_DETAILS.get(plan, PLAN_DETAILS["free"]),
219219
"subscription_status": "active" if plan != "free" else "none",
220-
"stripe_subscription_id": subscription_id,
220+
"subscription_id": subscription_id,
221221
"current_period_end": None,
222222
"cancel_at_period_end": False,
223223
"emails_used_this_month": emails_used,
@@ -230,7 +230,7 @@ async def get_subscription_status(user_id: str) -> dict:
230230
"current_plan": "free",
231231
"plan_details": PLAN_DETAILS["free"],
232232
"subscription_status": "none",
233-
"stripe_subscription_id": None,
233+
"subscription_id": None,
234234
"current_period_end": None,
235235
"cancel_at_period_end": False,
236236
"emails_used_this_month": 0,

frontend/lib/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export interface BillingStatus {
183183
emails_used_this_month: number;
184184
email_limit: number | null;
185185
stripe_customer_id?: string;
186-
stripe_subscription_id?: string;
186+
subscription_id?: string;
187187
}
188188

189189
// ─── API Response Types ───────────────────────────────────────────────────────

frontend/pages/billing/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export default function BillingPage() {
216216
</p>
217217
)}
218218
</div>
219-
{billing.stripe_subscription_id && (
219+
{billing.subscription_id && (
220220
<a
221221
href="https://dashboard.razorpay.com"
222222
target="_blank"

0 commit comments

Comments
 (0)