> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Package: appInstance

# Webhook link: https://dev.wix.com/docs/api-reference/app-management/app-instance/paid-plan-auto-renewal-cancelled.md

# Webhook Permissions Scopes IDs:
Manage Your App: SCOPE.DC.MANAGE-YOUR-APP

## Introduction

Triggered when a Wix user either cancels a paid plan for your app, or cancels the plan's auto-renewal. The
Wix user can continue to use your app until the end of the current billing
cycle.

---

## REST API

### Schema

```
Webhook: Paid Plan Auto Renewal Cancelled
Description: Triggered when a Wix user either cancels a paid plan for your app, or cancels the plan's auto-renewal. The Wix user can continue to use your app until the end of the current billing cycle.
Payload: PaidPlanAutoRenewalCancelled
  - name: operationTimeStamp | type: string | description: Date and time of auto-renewal cancellation.
  - name: vendorProductId | type: string | description: Current app plan.
  - name: cycle | type: PaymentCycle | description: Current payment cycle.
     - enum: NO_CYCLE, MONTHLY, YEARLY, ONE_TIME, TWO_YEARS, THREE_YEARS, FOUR_YEARS, FIVE_YEARS
  - name: cancelReason | type: string | description: Supported values: `UNKNOWN_CANCELLATION_TYPE_ERROR_STATE`, `USER_CANCEL`, `FAILED_PAYMENT`, `TRANSFER_CANCELLATION_REASON`. Reason provided by app for cancellation (if relevant).
  - name: userReason | type: string | description: Reason provided by site owner for cancellation (if relevant).
  - name: subscriptionCancellationType | type: string | description: Cancellation type.
  - name: cancelledDuringFreeTrial | type: FreeTrialPeriod | description: Whether the cancellation occurred during a free trial.
     - enum:
     -     DURING_FREE_TRIAL: During a free trial period.
     -     NOT_DURING_FREE_TRIAL: Not during a free trial period.

```

### Examples


```curl
{
    "operationTimeStamp": "2019-12-09T07:55:18.356Z",
    "vendorProductId": "e8f429d4-0a6a-468f-8044-87f519a53202",
    "cycle": "MONTHLY",
    "cancelReason": "USER_CANCEL",
    "userReason": "Cancel reason: No reason chosen",
    "subscriptionCancellationType": "AT_END_OF_PERIOD"
}

```

---

## JavaScript SDK

### Schema

```
Webhook: onAppInstancePaidPlanAutoRenewalCancelled
Description: Triggered when a Wix user either cancels a paid plan for your app, or cancels the plan's auto-renewal. The Wix user can continue to use your app until the end of the current billing cycle.
Payload: AppInstancePaidPlanAutoRenewalCancelledEnvelope
  - name: data | type: PaidPlanAutoRenewalCancelled | description: none
     - name: operationTimeStamp | type: Date | description: Date and time of auto-renewal cancellation.
     - name: vendorProductId | type: string | description: Current app plan.
     - name: cycle | type: PaymentCycle | description: Current payment cycle.
         - enum: NO_CYCLE, MONTHLY, YEARLY, ONE_TIME, TWO_YEARS, THREE_YEARS, FOUR_YEARS, FIVE_YEARS
     - name: cancelReason | type: string | description: Supported values: `UNKNOWN_CANCELLATION_TYPE_ERROR_STATE`, `USER_CANCEL`, `FAILED_PAYMENT`, `TRANSFER_CANCELLATION_REASON`. Reason provided by app for cancellation (if relevant).
     - name: userReason | type: string | description: Reason provided by site owner for cancellation (if relevant).
     - name: subscriptionCancellationType | type: string | description: Cancellation type.
     - name: cancelledDuringFreeTrial | type: FreeTrialPeriod | description: Whether the cancellation occurred during a free trial.
         - enum:
         -     DURING_FREE_TRIAL: During a free trial period.
         -     NOT_DURING_FREE_TRIAL: Not during a free trial period.
  - name: metadata | type: BaseEventMetadata | description: none
     - name: instanceId | type: string | description: App instance GUID.
     - name: eventType | type: string | description: Event type.
     - name: identity | type: IdentificationData | description: The identification type and identity data.
        - ONE-OF:
           - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.
           - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.
           - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).
           - name: appId | type: string | description: GUID of an app.
        - name: identityType | type: WebhookIdentityType | description: 
             - enum: UNKNOWN, ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
     - name: accountInfo | type: AccountInfo | description: Details related to the account
        - name: accountId | type: string | description: GUID of the Wix account associated with the event.
        - name: parentAccountId | type: string | description: GUID of the parent Wix account. Only included when accountId belongs to a child account.
        - name: siteId | type: string | description: GUID of the Wix site associated with the event. Only included when the event is tied to a specific site.

```

### Examples


```javascript
import { appInstances } from '@wix/app-management';

appInstances.onAppInstancePaidPlanAutoRenewalCancelled((event) => {
    // handle your event here
});
```


```javascript
import { createClient, AppStrategy } from '@wix/sdk';
import { appInstances } from '@wix/app-management';

const wixClient = createClient({
  auth: AppStrategy({
    appId: 'MY-APP-ID',
    publicKey: 'YOUR_APP_PUBLIC_KEY',
  }),
  modules: {
      appInstances,
    },
});

wixClient.appInstances.onAppInstancePaidPlanAutoRenewalCancelled((event) => {
    // handle your event here
});
```

---