Search...
onOrderAutoRenewCanceled( )
An event that triggers when an order is canceled with effectiveAt
as NEXT_PAYMENT_DATE
.
Description
The onOrderAutoRenewCanceled()
event handler runs when an order's auto-renewal is canceled for the next payment date.
The received OrderAutoRenewCanceled
object contains information about the order whose auto-renewal is canceled for the next payment date.
The onOrderAutoRenewCanceled()
event will not trigger in the following scenarios:
- If the order was canceled with
effectiveAt
asIMMEDIATELY
. - When an order expires by reaching its
endDate
and was not canceled.
Note: Backend events don't work when previewing your site.
Syntax
function onOrderAutoRenewCanceled(event: OrderAutoRenewCanceledEvent): void
onOrderAutoRenewCanceled Parameters
NAME
TYPE
DESCRIPTION
event
OrderAutoRenewCanceledEvent
Information about the order whose auto-renewal is canceled and metadata for the event.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event triggered when an order's auto-renewal is canceled
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.3// Add the file if it doesn't exist.45export function wixPricingPlans_onOrderAutoRenewCanceled(event) {6 const orderId = event.data.order._id;7 const eventId = event.metadata.id;8 const eventTime = event.metadata.eventTime;9}1011/* Full event object:12 * {13 * "metadata": {14 * "id":"5eb980d2-f734-4962-a043-e7d3b1d84797",15 * "entityId":"c778761f-0d19-4533-ac6d-434408398bf9",16 * "eventTime":"2022-08-08T10:55:10.795171Z",17 * "triggeredByAnonymizeRequest":false18 * },19 * "data": {20 * "order": {21 * "_id":"c778761f-0d19-4533-ac6d-434408398bf9",22 * "planId":"099e2c86-3b7e-4477-8c27-f77402b8cceb",23 * "subscriptionId":"5493bc14-2ca4-4496-ba43-bcfc0fc3a47c",24 * "wixPayOrderId":"c63bcec6-dc46-4080-8892-82cb09492986",25 * "buyer": {26 * "memberId":"fac761ea-e6f1-4e3d-8b30-a4852f091415",27 * "contactId":"fac761ea-e6f1-4e3d-8b30-a4852f091415"28 * },29 * "priceDetails": {30 * "subtotal":"74.99",31 * "discount":"0",32 * "total":"74.99",33 * "planPrice":"74.99",34 * "currency":"EUR",35 * "subscription": {36 * "cycleDuration": {37 * "count":1,38 * "unit":"MONTH"39 * },40 * "cycleCount":341 * }},42 * "pricing": {43 * "subscription": {44 * "cycleDuration": {45 * "count":1,46 * "unit":"MONTH"47 * },48 * "cycleCount":349 * },50 * "prices": [{51 * "duration": {52 * "cycleFrom":1,53 * "numberOfCycles":354 * },55 * "price": {56 * "subtotal":"74.99",57 * "discount":"0",58 * "total":"74.99",59 * "currency":"EUR"60 * }61 * }]},62 * "type":"OFFLINE",63 * "orderMethod":"UNKNOWN",64 * "status":"ACTIVE",65 * "autoRenewCanceled":true,66 * "cancellation": {67 * "cause":"OWNER_ACTION",68 * "effectiveAt":"NEXT_PAYMENT_DATE"69 * },70 * "lastPaymentStatus":"PAID",71 * "startDate":"2022-06-08T11:00:00.000Z",72 * "endDate":"2022-08-08T11:00:00.000Z",73 * "pausePeriods":[],74 * "earliestEndDate":"2022-09-08T11:00:00.000Z",75 * "currentCycle": {76 * "index":2,77 * "startedDate":"2022-07-08T11:00:00.000Z",78 * "endedDate":"2022-08-08T11:00:00.000Z"79 * },80 * "planName":"Platinum Pro",81 * "planDescription":"",82 * "planPrice":"74.99",83 * "_createdDate":"2022-08-08T10:54:30.869Z",84 * "_updatedDate":"2022-08-08T10:55:10.677Z"85 * }}86 * }87 */