refactored webhook realted to coupon 2

This commit is contained in:
rizwanisready
2024-08-05 18:51:49 +05:30
parent 73ca0ea974
commit 3ac7e0d522

View File

@@ -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")