Search.../

onOrderCycleStarted( )

Developer Preview

Triggered at the start of a new payment cycle for an existing order.

Description

This webhook is not triggered at the initial start of an offline order.

Syntax

function wixPricingPlans_onOrderCycleStarted(event: OrderCycleStartedEvent): void

onOrderCycleStarted Parameters

NAME
TYPE
DESCRIPTION
event
Optional
OrderCycleStartedEvent

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

onOrderCycleStarted example

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixPricingPlans_onOrderCycleStarted(event) {
6 const orderId = event.data.order._id;
7 const transactionId = event.data.transactionId;
8 const eventTime = event.metadata.eventTime;
9
10 console.log(`Order ID ${orderId} has started its order cycle with transaction ID ${transactionId} at ${eventTime}. The full event object:`, event);
11}
12/* Full event object:
13 * {
14 * "data": {
15 * "cycleNumber": 1,
16 * "order": {
17 * "_createdDate": "2024-01-25T11:45:05.036Z",
18 * "_id": "3b620f8b-33f3-4e29-b1db-c21d7a6afa01",
19 * "_updatedDate": "2024-01-25T11:45:05.036Z",
20 * "buyer": {
21 * "contactId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4",
22 * "memberId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4"
23 * },
24 * "currentCycle": {
25 * "index": 1,
26 * "startedDate": "2024-01-25T11:45:05.036Z"
27 * },
28 * "cycles": [
29 * {
30 * "index": 1,
31 * "startedDate": "2024-01-25T11:45:05.036Z"
32 * }
33 * ],
34 * "formData": {
35 * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb",
36 * "submissionData": {},
37 * "submissionId": "1b282868-0a1e-42c6-9123-3a611b0014bf"
38 * },
39 * "lastPaymentStatus": "NOT_APPLICABLE",
40 * "orderMethod": "UNKNOWN",
41 * "pausePeriods": [],
42 * "planDescription": "",
43 * "planId": "aa0d8e0e-99ad-4c95-ac48-4955e37956c5",
44 * "planName": "Default",
45 * "planPrice": "0",
46 * "priceDetails": {
47 * "currency": "EUR",
48 * "discount": "0",
49 * "fees": [],
50 * "planPrice": "0",
51 * "proration": "0",
52 * "subtotal": "0.00",
53 * "total": "0"
54 * },
55 * "pricing": {
56 * "prices": [
57 * {
58 * "duration": {
59 * "cycleFrom": 1,
60 * "numberOfCycles": 1
61 * },
62 * "price": {
63 * "currency": "EUR",
64 * "discount": "0",
65 * "fees": [],
66 * "proration": "0",
67 * "subtotal": "0.00",
68 * "total": "0"
69 * }
70 * }
71 * ],
72 * "singlePaymentUnlimited": true
73 * },
74 * "startDate": "2024-01-25T11:45:05.036Z",
75 * "status": "ACTIVE",
76 * "statusNew": "DRAFT",
77 * "subscriptionId": "e9fff457-bc89-4c8c-94c0-1d162711c9a6",
78 * "type": "ONLINE"
79 * }
80 * },
81 * "metadata": {
82 * "entityId": "3b620f8b-33f3-4e29-b1db-c21d7a6afa01",
83 * "eventTime": "2024-01-25T11:45:06.852478956Z",
84 * "id": "9481d95b-3fd6-423c-af43-5198bed9691c",
85 * "triggeredByAnonymizeRequest": false
86 * }
87 * }
88 */
89
90