Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Handle cases where default payment method might not be specified

vishnukvmd2dcf5daf5486
diff --git a/server/pkg/controller/stripe.go b/server/pkg/controller/stripe.go
index 57fdbc584e..5447a43d05 100644
--- a/server/pkg/controller/stripe.go
+++ b/server/pkg/controller/stripe.go
@@ -518,7 +518,12 @@ func (c *StripeController) UpdateSubscription(stripeID string, userID int64) (en
if err != nil {
return ente.SubscriptionUpdateResponse{}, stacktrace.Propagate(err, "")
}
- isSEPA := stripeSubscription.DefaultPaymentMethod.Type == stripe.PaymentMethodTypeSepaDebit
+ isSEPA := false
+ if stripeSubscription.DefaultPaymentMethod != nil {
+ isSEPA = stripeSubscription.DefaultPaymentMethod.Type == stripe.PaymentMethodTypeSepaDebit
+ } else {
+ log.Info("No default payment method found")
+ }
var paymentBehavior stripe.SubscriptionPaymentBehavior
if isSEPA {
paymentBehavior = stripe.SubscriptionPaymentBehaviorAllowIncomplete