Search.../

onPlanUpdated( )

Developer Preview

An event that is triggered when a pricing plan is updated.

Syntax

function wixPricingPlans_onPlanUpdated(event: PlanUpdated): void

onPlanUpdated Parameters

NAME
TYPE
DESCRIPTION
event
Optional
PlanUpdated

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Copy Code
1export function wixPricingPlans_onPlanUpdated(event) {
2 const planId = event.data._id;
3 const planName = event.data.name;
4 const eventTime = event.metadata.eventTime;
5
6 console.log(`The plan, ${planName} with ID ${planId} was updated at ${eventTime}. Full event object:`, event);
7}
8
9/* Full event object:
10 * {
11 * "entity": {
12 * "_createdDate": "2024-01-07T07:28:42.863Z",
13 * "_id": "838f2c9d-c8d0-4799-a10a-e2f23849db10",
14 * "_updatedDate": "2024-01-07T08:36:07.520Z",
15 * "allowFutureStartDate": false,
16 * "archived": false,
17 * "buyerCanCancel": true,
18 * "description": "Complete with all features. One month free trial.",
19 * "hasOrders": false,
20 * "maxPurchasesPerBuyer": 0,
21 * "name": "Premium Plan - annual - 30 day trial",
22 * "perks": [
23 * "Unlimited video library streaming access",
24 * "File sharing enabled for all channels"
25 * ],
26 * "pricing": {
27 * "freeTrialDays": 30,
28 * "price": {
29 * "value": "500",
30 * "currency": "EUR"
31 * },
32 * "subscription": {
33 * "cycleDuration": {
34 * "count": 1,
35 * "unit": "YEAR"
36 * },
37 * "cycleCount": 2
38 * }
39 * },
40 * "primary": false,
41 * "public": true,
42 * "slug": "premium-plan-annual-30-day-trial-1",
43 * "termsAndConditions": "Unlimited usage of services, subject to Fair Usage and Code of Conduct policies."
44 * },
45 * "metadata": {
46 * "entityId": "838f2c9d-c8d0-4799-a10a-e2f23849db10",
47 * "eventTime": "2024-01-07T08:36:07.557665422Z",
48 * "id": "287b52a3-d937-4911-ab09-d782e44b415b",
49 * "triggeredByAnonymizeRequest": false
50 * }
51 * }
52 */