> 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

# Method name: onOrderUpdated(event: OrderUpdated)

# Method package: wixPricingPlansV2

# Method menu location: wixPricingPlansV2 --> onOrderUpdated

# Method Link: https://dev.wix.com/docs/velo/events-service-plugins/pricing-plans/events/on-order-updated.md

# Method Description:

Triggered for any of the following update events:

+ Order is paid for. Order Purchased is also triggered.
+ Order reaches its start date or end date. Order Started and Order Ended, respectively, are also triggered.
+ New payment cycle of an order starts. Order Cycle Started is also triggered.
+ Offline order is marked as paid. Order Marked As Paid is also triggered.
+ End date of the order is postponed. Order End Date Postponed is also triggered
+ Order is paused, or a paused order is resumed. Order Paused and Order Resumed, respectively, are also triggered.
+ Order is canceled, either immediately or at the end of the payment cycle. Order Canceled and Order Auto Renew Canceled, respectively, are also triggered.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## onOrderUpdated example

```javascript
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.

export function wixPricingPlans_onOrderUpdated(event) {
  const orderId = event.data.order._id;
  const eventTime = event.metadata.eventTime;
  const buyerContactId = event.data.buyer.contactId;

  console.log(`Order update: Order ID ${orderId} was updated at ${eventTime} by contact ID ${buyerContactId}. Full event object:`, event);
}

/* Full event object:
 * {
 *   "entity": {
 *     "_createdDate": "2024-02-06T06:56:57.193Z",
 *     "_id": "537a3f44-57bf-4658-9833-47357198d88d",
 *     "_updatedDate": "2024-02-06T06:57:24.932Z",
 *     "buyer": {
 *       "contactId": "695568ff-1dc2-49ff-83db-2b518d35692b",
 *       "memberId": "695568ff-1dc2-49ff-83db-2b518d35692b"
 *     },
 *     "currentCycle": {
 *       "index": 1,
 *       "startedDate": "2024-02-06T06:56:57.193Z"
 *     },
 *     "cycles": [
 *       {
 *         "index": 1,
 *         "startedDate": "2024-02-06T06:56:57.193Z"
 *       }
 *     ],
 *     "formData": {
 *       "submissionData": {}
 *     },
 *     "lastPaymentStatus": "PAID",
 *     "orderMethod": "UNKNOWN",
 *     "pausePeriods": [],
 *     "planDescription": "Full feature enablement - lifetime plan",
 *     "planId": "e901222b-c137-4bc7-adc3-c1efa3c880a2",
 *     "planName": "Quality Plan - Lifetime",
 *     "planPrice": "1500",
 *     "priceDetails": {
 *       "coupon": {
 *         "_id": "07de4c3a-536b-4c30-adb9-991935da1681",
 *         "amount": "1500.00",
 *         "code": "sale-day"
 *       },
 *       "currency": "USD",
 *       "discount": "1500.00",
 *       "planPrice": "1500",
 *       "singlePaymentUnlimited": true,
 *       "subtotal": "1500.00",
 *       "tax": {
 *         "amount": "0",
 *         "includedInPrice": false,
 *         "name": "Tax",
 *         "rate": "6.5"
 *       },
 *       "total": "0"
 *     },
 *     "pricing": {
 *       "prices": [
 *         {
 *           "duration": {
 *             "cycleFrom": 1,
 *             "numberOfCycles": 1
 *           },
 *           "price": {
 *             "currency": "USD",
 *             "discount": "1500.00",
 *             "fees": [],
 *             "proration": "0",
 *             "subtotal": "1500.00",
 *             "tax": {
 *               "amount": "0",
 *               "includedInPrice": false,
 *               "name": "Tax",
 *               "rate": "6.5"
 *             },
 *             "total": "0"
 *           }
 *         }
 *       ],
 *       "singlePaymentUnlimited": true
 *     },
 *     "startDate": "2024-02-06T06:56:57.193Z",
 *     "status": "ACTIVE",
 *     "statusNew": "ACTIVE",
 *     "subscriptionId": "24bd018a-a4a2-4ca4-b83b-b4af9d6d8eb4",
 *     "type": "ONLINE",
 *     "wixPayOrderId": "2e0c2738-8541-43f5-842b-37c7e94e9f4c"
 *   },
 *   "metadata": {
 *     "entityId": "537a3f44-57bf-4658-9833-47357198d88d",
 *     "eventTime": "2024-02-06T06:57:26.229867928Z",
 *     "id": "5212464e-f2c6-423f-b768-05401295b94d",
 *     "triggeredByAnonymizeRequest": false
 *   }
 * }
 */


```

---