From dbaae9c2b75d2b89ecbea0230a8499d5c22e49af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Sun, 17 Dec 2017 16:47:50 +0200 Subject: [PATCH] Most recent payment method is the default payment method. --- hc/payments/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hc/payments/views.py b/hc/payments/views.py index 84909472..69bfebbf 100644 --- a/hc/payments/views.py +++ b/hc/payments/views.py @@ -97,7 +97,8 @@ def create_plan(request): if "payment_method_nonce" in request.POST: result = braintree.PaymentMethod.create({ "customer_id": sub.customer_id, - "payment_method_nonce": request.POST["payment_method_nonce"] + "payment_method_nonce": request.POST["payment_method_nonce"], + "options": {"make_default": True} }) if not result.is_success: @@ -153,7 +154,8 @@ def update_payment_method(request): result = braintree.PaymentMethod.create({ "customer_id": sub.customer_id, - "payment_method_nonce": request.POST["payment_method_nonce"] + "payment_method_nonce": request.POST["payment_method_nonce"], + "options": {"make_default": True} }) if not result.is_success: