An event that triggers when an order is canceled with effectiveAt
as NEXT_PAYMENT_DATE
.
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:
effectiveAt
as IMMEDIATELY
.endDate
and was not canceled.Note: Backend events don't work when previewing your site.
function onOrderAutoRenewCanceled(event: OrderAutoRenewCanceledEvent): void;
Information about the order whose auto-renewal is canceled and metadata for the event.
// 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_onOrderAutoRenewCanceled(event) {
const orderId = event.data.order._id;
const eventId = event.metadata.id;
const eventTime = event.metadata.eventTime;
}
/* Full event object:
* {
* "metadata": {
* "id":"5eb980d2-f734-4962-a043-e7d3b1d84797",
* "entityId":"c778761f-0d19-4533-ac6d-434408398bf9",
* "eventTime":"2022-08-08T10:55:10.795171Z",
* "triggeredByAnonymizeRequest":false
* },
* "data": {
* "order": {
* "_id":"c778761f-0d19-4533-ac6d-434408398bf9",
* "planId":"099e2c86-3b7e-4477-8c27-f77402b8cceb",
* "subscriptionId":"5493bc14-2ca4-4496-ba43-bcfc0fc3a47c",
* "wixPayOrderId":"c63bcec6-dc46-4080-8892-82cb09492986",
* "buyer": {
* "memberId":"fac761ea-e6f1-4e3d-8b30-a4852f091415",
* "contactId":"fac761ea-e6f1-4e3d-8b30-a4852f091415"
* },
* "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":"ACTIVE",
* "autoRenewCanceled":true,
* "cancellation": {
* "cause":"OWNER_ACTION",
* "effectiveAt":"NEXT_PAYMENT_DATE"
* },
* "lastPaymentStatus":"PAID",
* "startDate":"2022-06-08T11:00:00.000Z",
* "endDate":"2022-08-08T11:00:00.000Z",
* "pausePeriods":[],
* "earliestEndDate":"2022-09-08T11:00:00.000Z",
* "currentCycle": {
* "index":2,
* "startedDate":"2022-07-08T11:00:00.000Z",
* "endedDate":"2022-08-08T11:00:00.000Z"
* },
* "planName":"Platinum Pro",
* "planDescription":"",
* "planPrice":"74.99",
* "_createdDate":"2022-08-08T10:54:30.869Z",
* "_updatedDate":"2022-08-08T10:55:10.677Z"
* }}
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.