#Thorkell
1 messages · Page 1 of 1 (latest)
hello! sure, can you share the section where you're updating the customers quantity, and what questions you have about it specifically?
So I'm using my user.rb file here:
def add_user_to_workspace_subscription
if workspace.users.count >= 1
StripeHelper.add_user_to_workspace_subscription(stripe_customer_id: workspace.stripe_customer_id)
else
Rails.logger.error "Stripe subscription not found for workspace with id: #{workspace.id}"
end
end
And the goal is to use this StripeHelper module to increment the quantity as people are invited to the workspace:
module StripeHelper
def add_user_to_workspace_subscription(stripe_customer_id, current_workspace)
stripe_subscription = current_workspace.stripe_product
quantity = current_workspace.users.count + 1
stripe_subscription.quantity = quantity
stripe_subscription.save
end
end
My question is, is this functionality even possible? Because that's definitely an ideal.
i mean, it looks logical, but you've tried it and said they aren't updating the customers quantity - what specifically doesn't work?
is your code making the request to update the quantity?
I kinda thought that's what the .save method was supposed to do ðŸ˜
which documentation did you refer to that says .save is how you update a subscription quantity? Can you share the link?
Well uhhh. I only am referencing ChatGPT. So I might be full of it. Lemme go look at the actual docs lol