habulaj commited on
Commit
0508be7
·
verified ·
1 Parent(s): 67cc691

Update routes/subscription.py

Browse files
Files changed (1) hide show
  1. routes/subscription.py +6 -1
routes/subscription.py CHANGED
@@ -281,7 +281,12 @@ async def subscription_details(data: SubscriptionRequest):
281
  # Obter o email do assinante
282
  customer_email = "N/A"
283
  customer_id = subscription.get("customer")
284
- if customer_id:
 
 
 
 
 
285
  customer_details = await async_stripe_request(
286
  stripe.Customer.retrieve,
287
  id=customer_id
 
281
  # Obter o email do assinante
282
  customer_email = "N/A"
283
  customer_id = subscription.get("customer")
284
+
285
+ # Se o customer_id for um objeto, extrair o ID corretamente
286
+ if isinstance(customer_id, dict):
287
+ customer_id = customer_id.get("id")
288
+
289
+ if customer_id and isinstance(customer_id, str): # Garante que é uma string
290
  customer_details = await async_stripe_request(
291
  stripe.Customer.retrieve,
292
  id=customer_id