summaryrefslogtreecommitdiff
path: root/fundraising
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2025-01-28 13:50:04 +0100
committerBaptiste Mispelon <bmispelon@gmail.com>2025-01-28 19:19:38 +0100
commit675ed458602bf2492efceec0431ca919739c8c09 (patch)
treeb1196ff89d666c375180bcfdde27e57c4c6e8fa3 /fundraising
parent1ad83391d421af077452b8a2630a7d7c23d7c2f9 (diff)
Fixed stripe crash in fundraising view
For some reason the subscriptions attribute is only available when expanded, ot by default.
Diffstat (limited to 'fundraising')
-rw-r--r--fundraising/views.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/fundraising/views.py b/fundraising/views.py
index b7cd3f9b..378724da 100644
--- a/fundraising/views.py
+++ b/fundraising/views.py
@@ -156,7 +156,9 @@ def manage_donations(request, hero):
def update_card(request):
donation = get_object_or_404(Donation, id=request.POST["donation_id"])
try:
- customer = stripe.Customer.retrieve(donation.stripe_customer_id)
+ customer = stripe.Customer.retrieve(
+ donation.stripe_customer_id, expand=["subscriptions"]
+ )
subscription = customer.subscriptions.retrieve(donation.stripe_subscription_id)
subscription.source = request.POST["stripe_token"]
subscription.save()