> 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: onOrderCanceled(event: OrderCanceledEvent) # Method package: wixPricingPlansBackend # Method menu location: wixPricingPlansBackend --> Events --> onOrderCanceled # Method Link: https://dev.wix.com/docs/velo/apis/wix-pricing-plans-backend/events/on-order-canceled.md # Method Description: An event that triggers when an order is canceled. The `onOrderCanceled()` event handler runs either immediately when an order is canceled `IMMEDIATELY` or at the end of the current payment cycle when an order is set to cancel at the `NEXT_PAYMENT_DATE`. The received `OrderCanceledEvent` object contains information about the canceled order. The `onOrderCanceled()` event will *not* trigger immediately when the order is canceled with `effectiveAt` as `NEXT_PAYMENT_DATE`. In that case, the [`onOrderAutoRenewCanceled()`](wix-pricing-plans-backend/events/on-order-auto-renew-canceled) event will trigger immediately and the `onOrderCanceled()` event will trigger following the current payment cycle. > **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 canceled ```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_onOrderCanceled(event) { const orderId = event.data.order._id; const eventId = event.metadata.id; const eventTime = event.metadata.eventTime; } /* Full event object: * { * "metadata": { * "id": "b54fa4e8-3739-4554-b884-1aaec298e202", * "entityId": "50a888fb-5b07-4b78-b3b9-4e02a7314728", * "eventTime": "2022-07-25T06:40:54.814784Z", * "triggeredByAnonymizeRequest":false * }, * "data": { * "order": { * "_id": "50a888fb-5b07-4b78-b3b9-4e02a7314728", * "planId": "099e2c86-3b7e-4477-8c27-f77402b8cceb", * "subscriptionId": "70a6511f-d929-422a-9478-029dd64b53ea", * "wixPayOrderId": "3163cb56-942b-418f-8ff5-700553f1863c", * "buyer": { * "memberId": "0c9bca47-1f00-4b92-af1c-7852452e949a", * "contactId": "0c9bca47-1f00-4b92-af1c-7852452e949a" * }, * "priceDetails": { * "subtotal": "74.99", * "discount": "0", * "total": "74.99", * "planPrice": "74.99", * "currency": "EUR", * "subscription": { * "cycleDuration": { * "count": 1, * "unit": "MONTH" * }, * "cycleCount": 3 * }}, * "pricing": { * "subscription": { * "cycleDuration": { * "count": 1, * "unit": "MONTH" * }, * "cycleCount": 3 * }, * "prices": [{ * "duration": { * "cycleFrom": 1, * "numberOfCycles": 3 * }, * "price": { * "subtotal": "74.99", * "discount": "0", * "total": "74.99", * "currency": "EUR" * } * }]}, * "type": "OFFLINE", * "orderMethod": "UNKNOWN", * "status": "CANCELED", * "autoRenewCanceled": true, * "cancellation": { * "cause": "OWNER_ACTION", * "effectiveAt": "IMMEDIATELY" * }, * "lastPaymentStatus": "UNPAID", * "startDate": "2022-07-19T12:06:33.259Z", * "endDate": "2022-07-25T06:40:54.602Z", * "pausePeriods": [], * "earliestEndDate": "2022-10-19T12:06:33.259Z", * "planName": "Platinum Pro", * "planDescription": "", * "planPrice": "74.99", * "_createdDate": "2022-07-19T12:06:33.259Z", * "_updatedDate": "2022-07-25T06:40:54.666Z" * } * } * } */ ``` ---