Spaces:
Running
Running
Update subscriptions.py
Browse files- subscriptions.py +3 -4
subscriptions.py
CHANGED
|
@@ -13,9 +13,8 @@ async def fetch_subscription(email: str):
|
|
| 13 |
|
| 14 |
user = user_res.data[0]
|
| 15 |
|
| 16 |
-
# 2. Fetch Stripe customer
|
| 17 |
cust_res = (
|
| 18 |
-
supabase.
|
| 19 |
.select("*")
|
| 20 |
.eq("email", email)
|
| 21 |
.execute()
|
|
@@ -32,7 +31,7 @@ async def fetch_subscription(email: str):
|
|
| 32 |
|
| 33 |
# 3. Fetch subscriptions
|
| 34 |
sub_res = (
|
| 35 |
-
supabase.
|
| 36 |
.select("*")
|
| 37 |
.eq("customer", customer["id"])
|
| 38 |
.in_("status", ["active", "trialing", "past_due"])
|
|
@@ -63,7 +62,7 @@ async def fetch_subscription(email: str):
|
|
| 63 |
|
| 64 |
if price_id:
|
| 65 |
price_res = (
|
| 66 |
-
supabase.
|
| 67 |
.select("id, nickname, product:product_id(name, description)")
|
| 68 |
.eq("id", price_id)
|
| 69 |
.execute()
|
|
|
|
| 13 |
|
| 14 |
user = user_res.data[0]
|
| 15 |
|
|
|
|
| 16 |
cust_res = (
|
| 17 |
+
supabase.schema("stripe").table("customers")
|
| 18 |
.select("*")
|
| 19 |
.eq("email", email)
|
| 20 |
.execute()
|
|
|
|
| 31 |
|
| 32 |
# 3. Fetch subscriptions
|
| 33 |
sub_res = (
|
| 34 |
+
supabase.schema("stripe".table("subscriptions")
|
| 35 |
.select("*")
|
| 36 |
.eq("customer", customer["id"])
|
| 37 |
.in_("status", ["active", "trialing", "past_due"])
|
|
|
|
| 62 |
|
| 63 |
if price_id:
|
| 64 |
price_res = (
|
| 65 |
+
supabase.schema("stripe").table("prices")
|
| 66 |
.select("id, nickname, product:product_id(name, description)")
|
| 67 |
.eq("id", price_id)
|
| 68 |
.execute()
|