Update routes/subscription.py
Browse files- routes/subscription.py +4 -3
routes/subscription.py
CHANGED
@@ -46,9 +46,10 @@ def create_checkout_session(data: SubscriptionRequest):
|
|
46 |
stylist_price = stylist["price"]
|
47 |
stylist_avatar = stylist["avatar"]
|
48 |
consultations = stylist["consultations"]
|
|
|
49 |
|
50 |
-
if not stylist_price or not consultations:
|
51 |
-
raise HTTPException(status_code=400, detail="Stylist
|
52 |
|
53 |
# 🔹 3. Criar Checkout Session no Stripe
|
54 |
session = stripe.checkout.Session.create(
|
@@ -73,7 +74,7 @@ def create_checkout_session(data: SubscriptionRequest):
|
|
73 |
],
|
74 |
subscription_data={
|
75 |
"metadata": {
|
76 |
-
"stylist_id":
|
77 |
"consultations_per_month": consultations
|
78 |
}
|
79 |
}
|
|
|
46 |
stylist_price = stylist["price"]
|
47 |
stylist_avatar = stylist["avatar"]
|
48 |
consultations = stylist["consultations"]
|
49 |
+
stylist_stripe_id = stylist["stripe_id"] # Pegando o ID correto do Stripe
|
50 |
|
51 |
+
if not stylist_price or not consultations or not stylist_stripe_id:
|
52 |
+
raise HTTPException(status_code=400, detail="Stylist profile is incomplete")
|
53 |
|
54 |
# 🔹 3. Criar Checkout Session no Stripe
|
55 |
session = stripe.checkout.Session.create(
|
|
|
74 |
],
|
75 |
subscription_data={
|
76 |
"metadata": {
|
77 |
+
"stylist_id": stylist_stripe_id, # Agora estamos enviando o stripe_id correto
|
78 |
"consultations_per_month": consultations
|
79 |
}
|
80 |
}
|