How to add an action after_create after a user selects a stripe plan

I am following this video https://gorails.com/episodes/referral-program-from-scratch to have a referral system.
Following it I have found easy to add a complete_referral! in the user model after a user is created.
Following it I have found easy to add a complete_referral! in the user model after a user is created.
before_validation :set_referral_code, on: :create # after_create :complete_referral! validates :referral_code, uniqueness: true def set_referral_code loop do self.referral_code = SecureRandom.hex(6) break unless self.class.exists?(referral_code: referral_code) end end # def complete_referral! # update(referral_completed_at: Time.zone.now) # add credit to referred_by user # end
But I would like how can I add the after_create :complete_referral! after a user selects a plan and has a subscription in the jumpstart
Thanks!
Notifications
You’re not receiving notifications from this thread.