From 85757e01c92cd52537e32ad184c5f467aaa683ba Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 31 Dec 2020 16:37:25 +0530 Subject: [PATCH] Save charge id --- webhook/views.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webhook/views.py b/webhook/views.py index 27b12b05..3c5adfef 100644 --- a/webhook/views.py +++ b/webhook/views.py @@ -269,6 +269,15 @@ def handle_webhook(request): billing_address_data=billing_address_data ) incomplete_pm.completed_at = datetime.datetime.now() + charges = "" + if len(payment_intent_obj.charges.data) > 0: + for d in payment_intent_obj.charges.data: + if charges == "": + charges = "%s" % d.id + else: + charges = "%s,%s" % (charges, d.id) + incomplete_pm.stripe_charge_id=charges + incomplete_pm.save() except (IncompletePaymentIntents.DoesNotExist, IncompletePaymentIntents.MultipleObjectsReturned) as ex: logger.error(str(ex))