diff --git a/manage_subscriptions/api/views.py b/manage_subscriptions/api/views.py index 28c80c5..e0b8de6 100644 --- a/manage_subscriptions/api/views.py +++ b/manage_subscriptions/api/views.py @@ -222,13 +222,9 @@ class StripeWebhookTest(APIView): status=status.HTTP_404_NOT_FOUND, message="Transaction not found" ) except Exception as e: - # Handle any other exceptions - WebhookEvent.objects.create( - event_id=event_id, - status="failed", - error_message=str(e), - event_payload=json.loads(payload), # Optionally store payload for audit - ) + webhook_event.status = "failed" + webhook_event.error_message = str(e) + webhook_event.save() return ApiResponse.error( status=status.HTTP_500_INTERNAL_SERVER_ERROR, message="Error processing event",