onOrderCreated( )


Triggered when an order is created.

Method Declaration
Copy
function wixPricingPlans_onOrderCreated(event: OrderCreated): void;
Method Parameters
eventOrderCreated

Information about the created order and metadata for the event.

onOrderCreated example
JavaScript
// 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_onOrderCreated(event) { const orderId = event.entity._id; const createdDate = event.entity._createdDate; const buyer = event.entity.buyer; console.log( `The order with ID ${event.orderId} to purchase the ${event.plan.name} plan was created on ${createdDate} by the buyer ${buyer}. The full event object:`, event, ); } /* Full event object: * { * "entity": { * "_createdDate": "2024-01-25T11:45:05.036Z", * "_id": "3b620f8b-33f3-4e29-b1db-c21d7a6afa01", * "_updatedDate": "2024-01-25T11:45:05.036Z", * "buyer": { * "contactId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4", * "memberId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4" * }, * "currentCycle": { * "index": 1, * "startedDate": "2024-01-25T11:45:05.036Z" * }, * "cycles": [ * { * "index": 1, * "startedDate": "2024-01-25T11:45:05.036Z" * } * ], * "formData": { * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "submissionData": {}, * "submissionId": "1b282868-0a1e-42c6-9123-3a611b0014bf" * }, * "lastPaymentStatus": "NOT_APPLICABLE", * "orderMethod": "UNKNOWN", * "pausePeriods": [], * "planDescription": "", * "planId": "aa0d8e0e-99ad-4c95-ac48-4955e37956c5", * "planName": "Default", * "planPrice": "0", * "pricing": { * "prices": [ * { * "duration": { * "cycleFrom": 1, * "numberOfCycles": 1 * }, * "price": { * "currency": "EUR", * "discount": "0", * "fees": [], * "proration": "0", * "subtotal": "0.00", * "total": "0" * } * } * ], * "singlePaymentUnlimited": true * }, * "startDate": "2024-01-25T11:45:05.036Z", * "status": "ACTIVE", * "statusNew": "DRAFT", * "subscriptionId": "e9fff457-bc89-4c8c-94c0-1d162711c9a6", * "type": "ONLINE" * }, * "metadata": { * "entityId": "3b620f8b-33f3-4e29-b1db-c21d7a6afa01", * "eventTime": "2024-01-25T11:45:06.457639259Z", * "id": "6a0b2d17-6211-4394-b3e4-9c1a1bb1b1cc", * "triggeredByAnonymizeRequest": false * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onOrderCycleStarted( )


Triggered at the start of a new payment cycle for an existing order.

Not triggered at the initial start of an offline order.

Method Declaration
Copy
Method Parameters
eventOrderCycleStartedEvent

Information about the order whose payment cycle started and metadata for the event.

onOrderCycleStarted example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onOrderEndDatePostponed( )


Triggered when an order's endDate is postponed.

Method Declaration
Copy
Method Parameters
eventOrderEndDatePostponedEvent

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

onOrderEndDatePostponed example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onOrderEnded( )


Triggered when an order ends.

This webhook is triggered:

  • When an order expires at the end of the current payment cycle.
  • When an order is canceled and effectiveAt is set to IMMEDIATELY.
Method Declaration
Copy
Method Parameters
eventOrderEndedEvent

Information about the order that ended and metadata for the event.

onOrderEnded example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onOrderMarkedAsPaid( )


Triggered when an offline order is marked as paid.

Method Declaration
Copy
Method Parameters
eventOrderMarkedAsPaidEvent

Information about the offline order that was paid and metadata for the event.

onOrderMarkedAsPaid example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onOrderPaused( )


Triggered when an order is paused.

Method Declaration
Copy
Method Parameters
eventOrderPausedEvent

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

onOrderPaused example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onOrderPurchased( )


Triggered for any of the following purchase events:

  • Order is paid in full.
  • At least 1 order cycle payment is paid for.
  • Offline order is created, even if not yet marked as paid.
  • Free order is created.
Method Declaration
Copy
Method Parameters
eventOrderPurchasedEvent

Information about the order that was purchased and metadata for the event.

onOrderPurchased example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?