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
| Method | Description |
|---|---|
Pelcro.subscription.cancel() | Canceling a subscription |
Event Detail
The event.detail object contains the canceled subscription:
| Property | Type | Description |
|---|---|---|
id | number | Subscription ID |
status | string | Updated subscription status |
plan | object | The subscription plan |
cancel_at_period_end | boolean | true - will cancel at period end |
current_period_end | string | When 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
- PelcroSubscriptionReactivated - If user reactivates before period ends
Related
- Events Overview - All available events
- PelcroSubscriptionCreate - Creation event
- Subscription Module - Subscription methods
Updated 1 day ago
