> 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: onOrderCycleStarted(event: OrderCycleStartedEvent) # Method package: wixPricingPlansBackend # Method menu location: wixPricingPlansBackend --> Events --> onOrderCycleStarted # Method Link: https://dev.wix.com/docs/velo/apis/wix-pricing-plans-backend/events/on-order-cycle-started.md # Method Description: An event that triggers at the start of each payment cycle for online orders. The `onOrderCycleStarted()` event handler runs when an order's payment cycle is triggered. The received `OrderCycleStarted` object contains information about the order whose cycle is triggered. This event handler runs when: + An online order starts, either at the current or a future date. + When a new payment cycle starts in an existing order. > **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's payment cycle started ```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_onOrderCycleStarted(event) { const orderId = event.data.order._id; const wixPayId = event.data.transactionId; const eventId = event.metadata.id; const eventTime = event.metadata.eventTime; } /* A full event object: * { * "metadata": { * "id":"2b71b90d-d535-4cc4-94ab-60753f6b2f3e", * "entityId":"b6a9c5ab-f692-4b21-b9d4-9f6875e6b2d0", * "eventTime":"2022-08-09T10:36:18.292166Z", * "triggeredByAnonymizeRequest":false * }, * "data": { * "order": { * "_id":"b6a9c5ab-f692-4b21-b9d4-9f6875e6b2d0", * "planId":"8b84025d-57a4-4028-8254-cdd8ab675d5c", * "subscriptionId":"67ab82ea-ade2-48d6-813c-cb8b4330d8d8", * "wixPayOrderId":"b4602b5d-362f-453a-84df-db02bf0d04e0", * "buyer": { * "memberId":"18c148cf-e151-4d60-9cbf-a22f20439a67", * "contactId":"18c148cf-e151-4d60-9cbf-a22f20439a67" * }, * "priceDetails": { * "subtotal":"4.99", * "discount":"0", * "total":"4.99", * "planPrice":"4.99", * "currency":"USD", * "subscription": { * "cycleDuration": { * "count":1, * "unit":"WEEK" * }, * "cycleCount":26 * }}, * "pricing": { * "subscription": { * "cycleDuration": { * "count":1, * "unit":"WEEK" * }, * "cycleCount":26 * }, * "prices": [{ * "duration": { * "cycleFrom":1, * "numberOfCycles":26 * }, * "price": { * "subtotal":"4.99", * "discount":"0", * "total":"4.99", * "currency":"USD" * } * }]}, * "type":"ONLINE", * "orderMethod":"UNKNOWN", * "status":"ACTIVE", * "autoRenewCanceled":false, * "lastPaymentStatus":"PAID", * "startDate":"2022-08-09T10:35:16.659Z", * "endDate":"2023-02-07T10:35:16.659Z", * "pausePeriods":[], * "earliestEndDate":"2023-02-07T10:35:16.659Z", * "currentCycle": { * "index":1, * "startedDate":"2022-08-09T10:35:16.659Z", * "endedDate":"2022-08-16T10:35:16.659Z" * }, * "planName":"Cooking for Kids", * "planDescription":"", * "planPrice":"4.99", * "_createdDate":"2022-08-09T10:35:16.659Z", * "_updatedDate":"2022-08-09T10:36:18.208Z" * }, * "cycleNumber":1 * } * } */ ``` ---