Skip to content

Commit e7faf15

Browse files
committed
multiple client domains check for checkout router
1 parent cc8200a commit e7faf15

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/routers/checkout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
load_dotenv()
14-
CLIENT_DOMAIN = os.getenv('CLIENT_DOMAIN')
14+
CLIENT_DOMAINS = os.getenv('CLIENT_DOMAIN').split(',')
1515
WEBHOOK_SECRET_KEY = os.getenv('WEBHOOK_SECRET_KEY')
1616
stripe.api_key = os.getenv('STRIPE_SECRET_KEY')
1717

@@ -27,7 +27,7 @@ def create_checkout_session(
2727
if url.endswith('/'):
2828
url = url.rstrip('/')
2929

30-
if not url.startswith(CLIENT_DOMAIN):
30+
if not any(url.startswith(domain) for domain in CLIENT_DOMAINS):
3131
raise HTTPException(status_code=400, detail="Invalid return URL")
3232

3333
try:

0 commit comments

Comments
 (0)