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"
* }
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.