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
function wixPricingPlans_onOrderMarkedAsPaid(
  event: OrderMarkedAsPaidEvent,
): void;
Method Parameters
eventOrderMarkedAsPaidEvent

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

onOrderMarkedAsPaid 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_onOrderMarkedAsPaid(event) { const orderId = event.entity._id; const paidDate = event.metadata.eventTime; const planId = event.data.planId; const buyerContactId = event.entity.buyer.contactId; console.log( `Order ID ${event.orderId} to purchase plan ID ${planId} was paid on ${paidDate} by the buyer contact ID ${buyerContactId}. The full event object:`, event, ); } /* Full event object: * { * "data": { * "order": { * "_createdDate": "2024-02-01T10:27:58.453Z", * "_id": "9af3cbe6-fe27-4fdb-a0b0-892289b03d22", * "_updatedDate": "2024-02-11T08:13:44.674Z", * "buyer": { * "contactId": "402ec90c-235a-45c4-b4cc-52204d5f6b00", * "memberId": "402ec90c-235a-45c4-b4cc-52204d5f6b00" * }, * "cancellation": { * "cause": "OWNER_ACTION", * "effectiveAt": "IMMEDIATELY" * }, * "cycles": [ * { * "endedDate": "2024-02-11T08:13:44.588Z", * "index": 1, * "startedDate": "2024-02-01T10:27:58.453Z" * } * ], * "endDate": "2024-02-11T08:13:44.588Z", * "formData": { * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "submissionData": {}, * "submissionId": "10206732-e789-40e9-957d-2c7f3398efc6" * }, * "lastPaymentStatus": "PAID", * "orderMethod": "UNKNOWN", * "pausePeriods": [ * { * "pauseDate": "2024-02-04T10:02:03.726Z", * "resumeDate": "2024-02-04T13:05:04.465Z", * "status": "ENDED" * } * ], * "planDescription": "", * "planId": "0da57ac8-c3d0-4687-8aea-4100781b6386", * "planName": "Expensive Plan", * "planPrice": "10000", * "pricing": { * "prices": [ * { * "duration": { * "cycleFrom": 1, * "numberOfCycles": 1 * }, * "price": { * "currency": "USD", * "discount": "10000.00", * "fees": [], * "proration": "0", * "subtotal": "10000.00", * "total": "0" * } * } * ], * "singlePaymentUnlimited": true * }, * "priceDetails": { * "coupon": { * "_id": "07de4c3a-536b-4c30-adb9-991935da1681", * "amount": "10000.00", * "code": "sale-day" * }, * "currency": "USD", * "discount": "10000.00", * "planPrice": "10000", * "singlePaymentUnlimited": true, * "subtotal": "10000.00", * "total": "0" * }, * "startDate": "2024-02-01T10:27:58.453Z", * "status": "CANCELED", * "statusNew": "CANCELED", * "subscriptionId": "0cd18587-a637-4327-a05c-ab4e86bd59fe", * "type": "ONLINE", * "wixPayOrderId": "4012ab0c-f1cb-4632-917e-f611de27dcad" * } * }, * "metadata": { * "entityId": "9af3cbe6-fe27-4fdb-a0b0-892289b03d22", * "eventTime": "2024-02-11T08:13:44.817334927Z", * "id": "601feaeb-7306-4428-b768-906f12938004", * "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?

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?