> 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`). > - 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: OrderUpdatedEvent) # Method package: wixPricingPlansBackend # Method menu location: wixPricingPlansBackend --> Events --> onOrderUpdated # Method Link: https://dev.wix.com/docs/velo/apis/wix-pricing-plans-backend/events/on-order-updated.md # Method Description: An event that triggers when an order is changed. The `onOrderUpdated()` event handler runs when an order has changed. The received `OrderUpdatedEvent` object contains information about the order that was updated. An order is considered changed and the `onOrderUpdated()` event handler runs if any of the following happens: + An order is paid. In this case, the [`onOrderPurchased()`](wix-pricing-plans-backend/events/on-order-purchased) event handler also runs. + An order reaches its start date. In this case, the [`onOrderStarted()`](wix-pricing-plans-backend/events/on-order-started) event handler also runs. + An order is canceled. In this case, the [`onOrderCanceled()`](wix-pricing-plans-backend/events/on-order-canceled) event handler also runs. + The end date of an order is postponed or brought forward. In this case, the `onOrderEndDatePostponed()` event handler also runs. + An order is paused or resumed. In this case, the [`onOrderPaused()`](wix-pricing-plans-backend/events/on-order-paused) or the [`onOrderResumed()`](wix-pricing-plans-backend/events/on-order-resumed) event handler also runs. + An order expired by reaching its end date. In this case, the [`onOrderEnded()`](wix-pricing-plans-backend/events/on-order-ended) event handler also runs. + The start date of an order has changed. In this case, the [`onOrderStartDateChanged()`](wix-pricing-plans-backend/events/on-order-start-date-changed) event handler also runs. + The payment cycle of an order starts. In this case, the [`onOrderCycleStarted()`](wix-pricing-plans-backend/events/on-order-cycle-started) event handler also runs. + The auto-renewal of an order is stopped. In this case, the [`onOrderAutoRenewCanceled()`](wix-pricing-plans-backend/events/on-order-auto-renew-canceled) event handler also runs. > **Note:** Backend events don't work when previewing your site. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## An event triggered when an order is changed ```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.entity._id; const eventId = event.metadata.id; const eventTime = event.metadata.eventTime; } /* Full event object: * { * "metadata": { * "id":"7af51145-c023-43ba-a0b3-52e434af0476", * "entityId":"beaf5979-536b-4659-b3fc-78cc08579eab", * "eventTime":"2022-07-26T15:19:06.124503Z", * "triggeredByAnonymizeRequest":false * }, * "entity": { * "_id":"beaf5979-536b-4659-b3fc-78cc08579eab", * "planId":"a4d57b6c-42eb-4416-b8dd-196f1c321b78", * "subscriptionId":"09c34718-6735-435c-8dd4-9ba7d7dcaa3e", * "wixPayOrderId":"c83359a7-833f-4689-8451-0f1211bdf184", * "buyer": { * "memberId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86", * "contactId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86" * }, * "priceDetails": { * "subtotal":"33", * "discount":"0", * "total":"33", * "planPrice":"33", * "currency":"EUR", * "singlePaymentForDuration": { * "count":6, * "unit":"MONTH" * }}, * "pricing": { * "singlePaymentForDuration": { * "count":6, * "unit":"MONTH" * }, * "prices": [{ * "duration": { * "cycleFrom":1, * "numberOfCycles":1 * }, * "price": { * "subtotal":"33", * "discount":"0", * "total":"33", * "currency":"EUR" * } * }]}, * "type":"OFFLINE", * "orderMethod":"UNKNOWN", * "status":"PENDING", * "lastPaymentStatus":"UNPAID", * "startDate":"2022-08-01T16:23:00.000Z", * "endDate":"2023-02-01T16:23:00.000Z", * "pausePeriods":[], * "earliestEndDate":"2023-02-01T16:23:00.000Z", * "planName":"One and Done", * "planDescription":"", * "planPrice":"33", * "_createdDate":"2022-07-24T08:17:04.278Z", * "_updatedDate":"2022-07-24T08:17:05.117Z" * } * } */ ``` ---