Update routes/hello.py
Browse files- routes/hello.py +7 -8
routes/hello.py
CHANGED
@@ -7,7 +7,7 @@ router = APIRouter()
|
|
7 |
stripe.api_key = "sk_test_51N6K5JB9VMe0qzbOjlJvMEsfdQyrFgV49vRaeErtmhrzHV3Cu3f5jMDJmrhKdI5uqvpHubjkmwDQgMOtCEmz19t800AouH7W6g"
|
8 |
stripe.api_version = "2023-10-16"
|
9 |
|
10 |
-
### **1️⃣ CREATE CONNECTED ACCOUNT
|
11 |
class AccountRequest(BaseModel):
|
12 |
email: str
|
13 |
|
@@ -17,19 +17,18 @@ def create_account(account_data: AccountRequest):
|
|
17 |
account = stripe.Account.create(
|
18 |
type="express",
|
19 |
email=account_data.email,
|
20 |
-
country="
|
21 |
business_type="individual",
|
22 |
business_profile={
|
23 |
-
"mcc": "7298", # Beauty & Barber Shops
|
24 |
"name": "Stylists Hub",
|
25 |
-
"product_description": "We connect stylists with clients through subscription services.",
|
26 |
"support_email": "[email protected]"
|
27 |
},
|
28 |
capabilities={
|
29 |
"transfers": {"requested": True},
|
30 |
"card_payments": {"requested": True}
|
31 |
-
}
|
32 |
-
default_currency="usd" # Allows transactions in USD
|
33 |
)
|
34 |
return {"account_id": account.id}
|
35 |
except Exception as e:
|
@@ -44,8 +43,8 @@ def create_account_link(link_data: AccountLinkRequest):
|
|
44 |
try:
|
45 |
account_link = stripe.AccountLink.create(
|
46 |
account=link_data.account_id,
|
47 |
-
return_url="https://yourdomain.com/success",
|
48 |
-
refresh_url="https://yourdomain.com/retry",
|
49 |
type="account_onboarding",
|
50 |
)
|
51 |
return {"url": account_link.url}
|
|
|
7 |
stripe.api_key = "sk_test_51N6K5JB9VMe0qzbOjlJvMEsfdQyrFgV49vRaeErtmhrzHV3Cu3f5jMDJmrhKdI5uqvpHubjkmwDQgMOtCEmz19t800AouH7W6g"
|
8 |
stripe.api_version = "2023-10-16"
|
9 |
|
10 |
+
### **1️⃣ CREATE CONNECTED ACCOUNT** ###
|
11 |
class AccountRequest(BaseModel):
|
12 |
email: str
|
13 |
|
|
|
17 |
account = stripe.Account.create(
|
18 |
type="express",
|
19 |
email=account_data.email,
|
20 |
+
country="US", # Changed to the United States
|
21 |
business_type="individual",
|
22 |
business_profile={
|
23 |
+
"mcc": "7298", # MCC for Beauty & Barber Shops (U.S.)
|
24 |
"name": "Stylists Hub",
|
25 |
+
"product_description": "We connect U.S. stylists with clients through subscription services.",
|
26 |
"support_email": "[email protected]"
|
27 |
},
|
28 |
capabilities={
|
29 |
"transfers": {"requested": True},
|
30 |
"card_payments": {"requested": True}
|
31 |
+
}
|
|
|
32 |
)
|
33 |
return {"account_id": account.id}
|
34 |
except Exception as e:
|
|
|
43 |
try:
|
44 |
account_link = stripe.AccountLink.create(
|
45 |
account=link_data.account_id,
|
46 |
+
return_url="https://yourdomain.com/success", # Updated return URL
|
47 |
+
refresh_url="https://yourdomain.com/retry", # Updated refresh URL
|
48 |
type="account_onboarding",
|
49 |
)
|
50 |
return {"url": account_link.url}
|