PelcroSubscriptionRenewed

Fired when a subscription is renewed

Overview

Fired when a subscription is manually renewed via the SDK.


Triggered By

MethodDescription
Pelcro.subscription.renew()Renewing a subscription
Pelcro.subscription.renewGift()Renewing a gift subscription

Event Detail

The event.detail object contains the renewed subscription:

PropertyTypeDescription
idnumberSubscription ID
statusstringSubscription status
planobjectThe subscription plan
current_period_startstringNew period start date
current_period_endstringNew period end date

Example

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

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

  // Show new expiration date
  const endDate = new Date(subscription.current_period_end);
  showMessage(`Renewed until ${endDate.toLocaleDateString()}`);

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

Related