This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when an order's startDate
is changed.
function wixPricingPlans_onOrderStartDateChanged(
event: OrderStartDateChangedEvent,
): void;
Information about the order whose start date changed 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_onOrderStartDateChanged(event) {
const orderId = event.data.order._id;
const buyerContactId = event.data.buyer.contactId;
const startDate = event.startDate;
console.log(
`Start date for order ID ${orderId} was changed to ${startDate} by contact ID ${buyerContactId}. Full event object:`,
event,
);
}
/* Full event object:
* {
* "data": {
* "order": {
* "_createdDate": "2024-02-14T11:15:57.921Z",
* "_id": "a15b2fdf-f21c-4d3e-bae2-12a344cc4cad",
* "_updatedDate": "2024-02-14T11:16:45.641Z",
* "buyer": {
* "contactId": "600e2577-6414-42a5-b35b-839e166eaf5a",
* "memberId": "600e2577-6414-42a5-b35b-839e166eaf5a"
* },
* "cycles": [
* {
* "index": 1,
* "startedDate": "2024-02-16T22:00:00.000Z"
* }
* ],
* "formData": {
* "submissionData": {}
* },
* "lastPaymentStatus": "UNPAID",
* "orderMethod": "UNKNOWN",
* "pausePeriods": [],
* "planDescription": "Full feature enablement - lifetime plan",
* "planId": "e901222b-c137-4bc7-adc3-c1efa3c880a2",
* "planName": "Quality Plan - Lifetime",
* "planPrice": "1500",
* "priceDetails": {
* "currency": "USD",
* "discount": "0",
* "planPrice": "1500",
* "subtotal": "1500.00",
* "tax": {
* "amount": "97.50",
* "includedInPrice": false,
* "name": "Tax",
* "rate": "6.5"
* },
* "total": "1597.50"
* },
* "pricing": {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 1
* },
* "price": {
* "currency": "USD",
* "discount": "0",
* "fees": [],
* "proration": "0",
* "subtotal": "1500.00",
* "tax": {
* "amount": "97.50",
* "includedInPrice": false,
* "name": "Tax",
* "rate": "6.5"
* },
* "total": "1597.50"
* }
* }
* ],
* "singlePaymentUnlimited": true
* },
* "startDate": "2024-02-16T22:00:00.000Z",
* "status": "DRAFT",
* "statusNew": "DRAFT",
* "subscriptionId": "78933e41-6482-4545-a7e0-483ec74cfa97",
* "type": "ONLINE",
* "wixPayOrderId": "97aa019c-13f2-4e2a-a8a2-62cd9ffa6ef0"
* }
* },
* "metadata": {
* "entityId": "a15b2fdf-f21c-4d3e-bae2-12a344cc4cad",
* "eventTime": "2024-02-14T11:16:45.787406262Z",
* "id": "05924d5a-5f1e-4f9a-ba77-f3a784661d41",
* "triggeredByAnonymizeRequest": false
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.