Search.../

onOrderPaused( )

An event that triggers when an order is paused.

Description

The onOrderPaused() event handler runs when an order is paused. The received OrderPausedEvent object contains information about the order that is paused.

Note: Backend events don't work when previewing your site.

Syntax

function onOrderPaused(event: OrderPausedEvent): void

onOrderPaused Parameters

NAME
TYPE
DESCRIPTION
event
OrderPausedEvent

Information about the order that is paused and metadata for the event.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event triggered when an order is paused

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_onOrderPaused(event) {
6 const orderId = event.data.order._id;
7 const eventId = event.metadata.id;
8 const eventTime = event.metadata.eventTime;
9}
10
11/* Full event object:
12 * {
13 * "metadata": {
14 * "id":"a4206ebf-fc82-4d8c-8c54-619a7392c6fe",
15 * "entityId":"066da054-3a62-4629-be0c-055ff5278f54",
16 * "eventTime":"2022-07-26T15:45:17.522380Z",
17 * "triggeredByAnonymizeRequest":false
18 * },
19 * "data": {
20 * "order":
21 * {
22 * "_id":"066da054-3a62-4629-be0c-055ff5278f54",
23 * "planId":"099e2c86-3b7e-4477-8c27-f77402b8cceb",
24 * "subscriptionId":"f30ad1c0-604f-4542-93e3-22b174159eac",
25 * "wixPayOrderId":"ee63dd97-3250-4fb9-afec-807d074bb682",
26 * "buyer": {
27 * "memberId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86",
28 * "contactId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86"
29 * },
30 * "priceDetails": {
31 * "subtotal":"74.99",
32 * "discount":"0",
33 * "total":"74.99",
34 * "planPrice":"74.99",
35 * "currency":"EUR",
36 * "subscription": {
37 * "cycleDuration": {
38 * "count":1,
39 * "unit":"MONTH"
40 * },
41 * "cycleCount":3
42 * }},
43 * "pricing": {
44 * "subscription": {
45 * "cycleDuration": {
46 * "count":1,
47 * "unit":"MONTH"
48 * },
49 * "cycleCount":3
50 * },
51 * "prices": [{
52 * "duration": {
53 * "cycleFrom":1,
54 * "numberOfCycles":3
55 * },
56 * "price": {
57 * "subtotal":"74.99",
58 * "discount":"0",
59 * "total":"74.99",
60 * "currency":"EUR"
61 * }
62 * }]},
63 * "type":"OFFLINE",
64 * "orderMethod":"UNKNOWN",
65 * "status":"PAUSED",
66 * "autoRenewCanceled":false,
67 * "lastPaymentStatus":"PAID",
68 * "startDate":"2022-07-26T14:14:36.346Z",
69 * "endDate":"2022-10-26T14:14:36.346Z",
70 * "pausePeriods": [{
71 * "status":"ACTIVE",
72 * "pauseDate":"2022-07-26T15:45:17.391Z"
73 * }],
74 * "earliestEndDate":"2022-10-26T14:14:36.346Z",
75 * "currentCycle": {
76 * "index":1,
77 * "startedDate":"2022-07-26T14:14:36.346Z"
78 * },
79 * "planName":"Platinum Pro",
80 * "planDescription":"",
81 * "planPrice":"74.99",
82 * "_createdDate":"2022-07-26T14:14:36.346Z",
83 * "_updatedDate":"2022-07-26T15:45:17.391Z"
84 * }
85 * }
86 * }
87 */