An event that triggers when an order expires or is canceled immediately.
The onOrderEnded()
event handler runs when an order expires.
The received OrderEndedEvent
object contains information about the order that expired.
Note: Backend events don't work when previewing your site.
function onOrderEnded(event: OrderEndedEvent): void;
Information about the order that ended 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_onOrderEnded(event) {
const orderId = event.data.order._id;
const eventId = event.metadata.id;
const eventTime = event.metadata.eventTime;
}
/* Full event object:
* {
* "metadata": {
* "id":"664bce7f-d30a-4d3f-8e1b-57840a766d25",
* "entityId":"c778761f-0d19-4533-ac6d-434408398bf9",
* "eventTime":"2022-08-08T11:00:03.912278Z",
* "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":"CANCELED",
* "autoRenewCanceled":true,
* "cancellation": {
* "cause":"OWNER_ACTION",
* "effectiveAt":"NEXT_PAYMENT_DATE"
* },
* "lastPaymentStatus":"PAID",
* "startDate":"2022-06-08T11:00:00.000Z",
* "endDate":"2022-08-08T11:00:02.862Z",
* "pausePeriods":[],
* "earliestEndDate":"2022-09-08T11:00:00.000Z",
* "planName":"Platinum Pro",
* "planDescription":"",
* "planPrice":"74.99",
* "_createdDate":"2022-08-08T10:54:30.869Z",
* "_updatedDate":"2022-08-08T11:00:03.781Z"
* }
* }
* }
*/
An event that triggers when an offline order is marked as paid.
The onOrderMarkedAsPaid()
event handler runs when an offline order is marked as paid.
The received OrderMarkedAsPaidEvent
object contains information about the offline order that was paid.
Note: Backend events don't work when previewing your site.
function onOrderMarkedAsPaid(event: OrderMarkedAsPaidEvent): void;
Information about the offline order that was paid 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_onOrderMarkedAsPaid(event) {
const orderId = event.data.order._id;
const eventId = event.metadata.id;
const eventTime = event.metadata.eventTime;
}
/* Full event object:
* {
* "metadata": {
* "id":"823f11e2-84fc-402a-b9a3-28a40a3a473d",
* "entityId":"beaf5979-536b-4659-b3fc-78cc08579eab",
* "eventTime":"2022-07-26T15:19:06.150998Z",
* "triggeredByAnonymizeRequest":false
* },
* "data": {
* "order": {
* "_id":"beaf5979-536b-4659-b3fc-78cc08579eab",
* "planId":"a4d57b6c-42eb-4416-b8dd-196f1c321b78",
* "subscriptionId":"09c34718-6735-435c-8dd4-9ba7d7dcaa3e",
* "wixPayOrderId":"c83359a7-833f-4689-8451-0f1211bdf184",
* "buyer": {
* "memberId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86",
* "contactId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86"
* },
* "priceDetails": {
* "subtotal":"33",
* "discount":"0",
* "total":"33",
* "planPrice":"33",
* "currency":"EUR",
* "singlePaymentForDuration": {
* "count":6,
* "unit":"MONTH"
* }},
* "pricing": {
* "singlePaymentForDuration": {
* "count":6,
* "unit":"MONTH"
* },
* "prices": [{
* "duration": {
* "cycleFrom":1,
* "numberOfCycles":1
* },
* "price": {
* "subtotal":"33",
* "discount":"0",
* "total":"33",
* "currency":"EUR"
* }
* }]},
* "type":"OFFLINE",
* "orderMethod":"UNKNOWN",
* "status":"PENDING",
* "lastPaymentStatus":"PAID",
* "startDate":"2022-08-01T16:23:00.000Z",
* "endDate":"2023-02-01T16:23:00.000Z",
* "pausePeriods":[],
* "earliestEndDate":"2023-02-01T16:23:00.000Z",
* "planName":"One and Done",
* "planDescription":"",
* "planPrice":"33",
* "_createdDate":"2022-07-24T08:17:04.278Z",
* "_updatedDate":"2022-07-26T15:19:06.118Z"
* }
* }
* }
*/
An event that triggers when an order is paused.
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.
function onOrderPaused(event: OrderPausedEvent): void;
Information about the order that is paused 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_onOrderPaused(event) {
const orderId = event.data.order._id;
const eventId = event.metadata.id;
const eventTime = event.metadata.eventTime;
}
/* Full event object:
* {
* "metadata": {
* "id":"a4206ebf-fc82-4d8c-8c54-619a7392c6fe",
* "entityId":"066da054-3a62-4629-be0c-055ff5278f54",
* "eventTime":"2022-07-26T15:45:17.522380Z",
* "triggeredByAnonymizeRequest":false
* },
* "data": {
* "order":
* {
* "_id":"066da054-3a62-4629-be0c-055ff5278f54",
* "planId":"099e2c86-3b7e-4477-8c27-f77402b8cceb",
* "subscriptionId":"f30ad1c0-604f-4542-93e3-22b174159eac",
* "wixPayOrderId":"ee63dd97-3250-4fb9-afec-807d074bb682",
* "buyer": {
* "memberId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86",
* "contactId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86"
* },
* "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":"PAUSED",
* "autoRenewCanceled":false,
* "lastPaymentStatus":"PAID",
* "startDate":"2022-07-26T14:14:36.346Z",
* "endDate":"2022-10-26T14:14:36.346Z",
* "pausePeriods": [{
* "status":"ACTIVE",
* "pauseDate":"2022-07-26T15:45:17.391Z"
* }],
* "earliestEndDate":"2022-10-26T14:14:36.346Z",
* "currentCycle": {
* "index":1,
* "startedDate":"2022-07-26T14:14:36.346Z"
* },
* "planName":"Platinum Pro",
* "planDescription":"",
* "planPrice":"74.99",
* "_createdDate":"2022-07-26T14:14:36.346Z",
* "_updatedDate":"2022-07-26T15:45:17.391Z"
* }
* }
* }
*/
An event that triggers when an order is purchased.
The onOrderPurchased()
event handler runs when an order is purchased.
The received OrderPurchasedEvent
object contains information about the order that was purchased.
An order is considered purchased if:
Note: Backend events don't work when previewing your site.
function onOrderPurchased(event: OrderPurchasedEvent): void;
Information about the order that was purchased 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_onOrderPurchased(event) {
const orderId = event.data.order._id;
const eventId = event.metadata.id;
const eventTime = event.metadata.eventTime;
}
/* Full event object:
* {
* "metadata": {
* "id":"f2e01b16-48c3-4365-89c7-1e3710639f50",
* "entityId":"938ca26d-41e0-4aae-81a2-286ae9afd6ef",
* "eventTime":"2022-07-26T14:59:49.951623Z",
* "triggeredByAnonymizeRequest":false
* },
* "data": {
* "order": {
* "_id":"938ca26d-41e0-4aae-81a2-286ae9afd6ef",
* "planId":"099e2c86-3b7e-4477-8c27-f77402b8cceb",
* "subscriptionId":"1b879750-b4c3-4b17-9687-1f18f6b0ea19",
* "wixPayOrderId":"3eb01dc8-45c7-426f-a910-13d8c6008532",
* "buyer": {
* "memberId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86",
* "contactId":"ea3d74df-b7dc-4ca1-a7c9-c416b9017a86"
* },
* "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":false,
* "lastPaymentStatus":"PAID",
* "startDate":"2022-01-25T16:23:00.000Z",
* "endDate":"2022-04-25T16:23:00.000Z",
* "pausePeriods":[],
* "earliestEndDate":"2022-04-25T16:23:00.000Z",
* "currentCycle": {
* "index":3,
* "startedDate":"2022-03-25T16:23:00.000Z",
* "endedDate":"2022-04-25T16:23:00.000Z"
* },
* "planName":"Platinum Pro",
* "planDescription":"",
* "planPrice":"74.99",
* "_createdDate":"2022-07-26T14:59:49.314Z",
* "_updatedDate":"2022-07-26T14:59:49.314Z"
* }
* }
* }
*/