From 9302712c3aeb223fd9ad6c63e573bd11ae3392ec Mon Sep 17 00:00:00 2001 From: teisnp Date: Mon, 12 Feb 2024 19:02:40 +0100 Subject: [PATCH] fixed cancel subscribtions --- internal/billing/service.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/internal/billing/service.go b/internal/billing/service.go index dd6b600..c2a2b1b 100644 --- a/internal/billing/service.go +++ b/internal/billing/service.go @@ -1,7 +1,6 @@ package billing import ( - "fmt" "os" "strconv" @@ -120,19 +119,12 @@ func (s *ServiceImpl) CancelSubscribtion(team *entities.Team) (*stripe.Subscript // Set Customer on session if already a customer sub := s.GetCustomerSubscribtion(*team.StripeCustomerID) - fmt.Println(sub.SubscriptionList()) sub.Next() teamSubscription := sub.Subscription() - params := &stripe.SubscriptionParams{ - Items: []*stripe.SubscriptionItemsParams{ - { - ID: stripe.String(teamSubscription.Items.Data[0].ID), - Deleted: stripe.Bool(true), - }, - }, - } - result, err := subscription.Update(teamSubscription.ID, params) + params := &stripe.SubscriptionCancelParams{} + result, err := subscription.Cancel(teamSubscription.ID, params) + if err != nil { return nil, errors.Wrap(err, "failed to update subscription") }