Skip to content

Commit 6041313

Browse files
committed
Fixed handling of token in card update view
Refs #1912
1 parent 6cd8827 commit 6041313

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fundraising/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ def update_card(request):
159159
customer = stripe.Customer.retrieve(
160160
donation.stripe_customer_id, expand=["subscriptions"]
161161
)
162+
token = stripe.Token.retrieve(request.POST["stripe_token"])
162163
subscription = customer.subscriptions.retrieve(donation.stripe_subscription_id)
163-
subscription.default_source = request.POST["stripe_token"]
164+
subscription.default_source = token.card.id
164165
subscription.save()
165166
except stripe.error.StripeError as e:
166167
data = {"success": False, "error": str(e)}

0 commit comments

Comments
 (0)