Posted in Using Webhooks with Stripe Discussion
I'm using `customer.subscription.updated` event to get notification when a recurring charge occurs, so that I can update user table for relevant attribute.
But this event will also trigger when customer manually changes/renew their plan from admin-panel before billing period ends; in this case too I'll update user table fields (similarly as above) but here, to update these attributes I've defined the code separately in my subscriptions controller.
There will be duplication of code and app will try to update user table fields, first based on controller code and then based on webhook event code. How to avoid this?
Well, now I understood. Thanks.
Yes, but what if user chose to upgrade/degrade their plan (e.g. from 'basic' to 'professional or vice versa). Plan upgradation/degradation should cancel previous plan and should subscribe to new plan. So, there should only be one active subscription at a time.
Nice tutorial. Using this payment form, if form is submitted multiple times, multiple subscriptions occur for a single customer. Will stripe charge customer for all such subscriptions or only based on last one?
I'm also facing this issue, apparently it seems when we come to 'checkout' page from any other page (e.g. pricing) the JS in checkout is not loaded correctly due to which the token is not being created. If you refresh the checkout page and then submit the form it should work fine. Probably the turbolink issue.
I was able to create a multi-tenant app based on this tutorial. But now any user can login from any subdomain and the data will be shown based on subdomain e.g. if 'user1' login from user2.example.com it will login fine but it will show records of 'user2'. Ideally, user1 should not be allowed to login from any subdomain other than user1.example.com and if it is logged in it should be redirected to correct subdomain url and never be allowed to see other users record.