diff --git a/manage_subscriptions/api/views.py b/manage_subscriptions/api/views.py index a91ec1b..cd89315 100644 --- a/manage_subscriptions/api/views.py +++ b/manage_subscriptions/api/views.py @@ -1,5 +1,6 @@ from datetime import timedelta import datetime +import json from django.db import transaction from django.shortcuts import get_object_or_404 from django.utils import timezone @@ -177,7 +178,7 @@ class StripeWebhookTest(APIView): endpoint_secret = "whsec_ccf1f87295603cdd1733995ee2d3c0d6f74c7ceaf28916ea45114a54b7ce1d0f" # Make sure to retrieve this from your settings event = None try: - event = stripe.Webhook.construct_event(payload, sig_header, endpoint_secret) + event = stripe.Event.construct_from(json.loads(payload), stripe.api_key) event_id = event["id"] event_type = event["type"] stripe_subscription_id = event["data"]["object"].get("subscription")