mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Add additional error handling for processing unknown Stripe events and fix typo in STRIPE_SIGNING env variable
This commit is contained in:
parent
08c86927cb
commit
0e1cdb6536
1 changed files with 4 additions and 1 deletions
|
@ -728,7 +728,7 @@ async def extract_references_and_questions(
|
|||
|
||||
# Stripe integration for Khoj Cloud Subscription
|
||||
stripe.api_key = os.getenv("STRIPE_API_KEY")
|
||||
endpoint_secret = os.getenv("STRIPE_SIGINING_SECRET")
|
||||
endpoint_secret = os.getenv("STRIPE_SIGNING_SECRET")
|
||||
|
||||
|
||||
@api.post("/subscription")
|
||||
|
@ -765,6 +765,9 @@ async def subscribe(request: Request):
|
|||
# Retrieve the customer's details
|
||||
customer_id = event["data"]["object"]["customer"]
|
||||
customer = stripe.Customer.retrieve(customer_id)
|
||||
else:
|
||||
logger.warn(f"Unhandled Stripe event type: {event['type']}, {event['data']['object']}")
|
||||
return {"success": False}
|
||||
|
||||
logger.info(f'Stripe subscription {event["type"]} for {customer["email"]}')
|
||||
|
||||
|
|
Loading…
Reference in a new issue