PelcroSubscriptionCancel

Fired when a subscription is canceled

Overview

Fired when a subscription is canceled. Note that canceled subscriptions typically remain active until the end of the current billing period.


Triggered By

MethodDescription
Pelcro.subscription.cancel()Canceling a subscription

Event Detail

The event.detail object contains the canceled subscription:

PropertyTypeDescription
idnumberSubscription ID
statusstringUpdated subscription status
planobjectThe subscription plan
cancel_at_period_endbooleantrue - will cancel at period end
current_period_endstringWhen access will end

Example

document.addEventListener('PelcroSubscriptionCancel', (event) => {
  const subscription = event.detail;

  console.log(`Subscription canceled: ${subscription.id}`);

  // Show access end date
  const endDate = new Date(subscription.current_period_end);
  showMessage(`Your access continues until ${endDate.toLocaleDateString()}`);

  // Track cancellation
  analytics.track('Subscription Canceled', {
    subscriptionId: subscription.id,
    planName: subscription.plan.name
  });

  // Show win-back offer
  showWinBackOffer();
});

Related Events


Related