We've moved discussions to Discord

How to subscribe users to a ConvertKit tag when they subscribe/cancel?

Benjamin Houy
Hi,

I'm trying to set up my app so users get added/removed from a ConvertKit tag when they sign up for a free trial or cancel their paid subscription.

I configured the ConvertKit integration and I understand how to add/remove tags in ConvertKit with it but I'm not quite sure where to put the code.

It seems that when users sign up for a free trial, Paddle sends a webhook and the subscriptions controller create action is fired so I added this:
  if @plan.has_trial?
    Jumpstart::Clients.convertkit.add_subscriber_to_tag(3033206, current_user.email)
  end
After this:
def create
  payment_processor = params[:processor] ? current_account.set_payment_processor(params[:processor]) : current_account.payment_processor
  payment_processor.payment_method_token = params[:payment_method_token]
  payment_processor.subscribe(
    plan: @plan.id_for_processor(payment_processor.processor),
    trial_period_days: @plan.trial_period_days
  )
Is this the correct place to put it?

Then, I'm not sure where to put the code for when users cancel their Paddle subscription. I assumed it would be in the subscription controller destroy action but I don't see this in the logs when canceling a subscription (even though it does get canceled properly.)

Where am I supposed to put it? 

Help would be much appreciated :)

Thanks
Notifications
You’re not receiving notifications from this thread.