PelcroSubscriptionCreate

Fired when a subscription is created

Overview

Fired when a new subscription is successfully created. Use this event to track conversions and update UI after purchase.


Triggered By

MethodDescription
Pelcro.subscription.create()Creating a new subscription

Event Detail

The event.detail object contains the created subscription:

PropertyTypeDescription
idnumberSubscription ID
statusstringSubscription status
planobjectThe subscribed plan
plan.idnumberPlan ID
plan.namestringPlan name
plan.intervalstringBilling interval
current_period_startstringCurrent period start date
current_period_endstringCurrent period end date
cancel_at_period_endbooleanWhether subscription will cancel at period end

Example

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

  console.log(`New subscription: ${subscription.plan.name}`);

  // Track conversion in analytics
  analytics.track('Subscription Created', {
    subscriptionId: subscription.id,
    planId: subscription.plan.id,
    planName: subscription.plan.name,
    interval: subscription.plan.interval
  });

  // Show confirmation
  showSuccessMessage(`Welcome! You're now subscribed to ${subscription.plan.name}`);

  // Unlock premium content
  unlockPremiumContent();
});

Related Events

After a subscription is created, you may also see:


Related