Skip to content

Commit 675ed45

Browse files
committed
Fixed stripe crash in fundraising view
For some reason the subscriptions attribute is only available when expanded, ot by default.
1 parent 1ad8339 commit 675ed45

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fundraising/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ def manage_donations(request, hero):
156156
def update_card(request):
157157
donation = get_object_or_404(Donation, id=request.POST["donation_id"])
158158
try:
159-
customer = stripe.Customer.retrieve(donation.stripe_customer_id)
159+
customer = stripe.Customer.retrieve(
160+
donation.stripe_customer_id, expand=["subscriptions"]
161+
)
160162
subscription = customer.subscriptions.retrieve(donation.stripe_subscription_id)
161163
subscription.source = request.POST["stripe_token"]
162164
subscription.save()

0 commit comments

Comments
 (0)