PelcroSubscriptionRenewed
Fired when a subscription is renewed
Overview
Fired when a subscription is manually renewed via the SDK.
Triggered By
| Method | Description |
|---|---|
Pelcro.subscription.renew() | Renewing a subscription |
Pelcro.subscription.renewGift() | Renewing a gift subscription |
Event Detail
The event.detail object contains the renewed subscription:
| Property | Type | Description |
|---|---|---|
id | number | Subscription ID |
status | string | Subscription status |
plan | object | The subscription plan |
current_period_start | string | New period start date |
current_period_end | string | New 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
- Events Overview - All available events
- PelcroSubscriptionCreate - Creation event
- Subscription Module - Subscription methods
Updated 1 day ago
