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 endDate
is postponed.
function wixPricingPlans_onOrderEndDatePostponed(
event: OrderEndDatePostponedEvent,
): void;
Information about the order that is postponed 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_onOrderEndDatePostponed(event) {
const orderId = event.data.order._id;
const buyerContactId = event.data.buyer.contactId;
const planId = event.data.planId;
console.log(
`Order ID of ${orderId} was postponed for plan ID ${planId} for buyer contact ID ${buyerContactId}. Full event object:`,
event,
);
}
/* Full event object:
* {
* "data": {
* "order": {
* "_createdDate": "2024-01-28T09:49:21.041Z",
* "_id": "82d99338-5653-459a-a751-b57483f7cfb5",
* "_updatedDate": "2024-02-07T13:22:47.459Z",
* "autoRenewCanceled": true,
* "buyer": {
* "contactId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4",
* "memberId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4"
* },
* "cancellation": {
* "cause": "OWNER_ACTION",
* "effectiveAt": "NEXT_PAYMENT_DATE"
* },
* "currentCycle": {
* "endedDate": "2024-04-27T09:49:21.041Z",
* "index": 0,
* "startedDate": "2024-01-28T09:49:21.041Z"
* },
* "cycles": [
* {
* "endedDate": "2024-04-27T09:49:21.041Z",
* "index": 0,
* "startedDate": "2024-01-28T09:49:21.041Z"
* }
* ],
* "endDate": "2024-04-27T09:49:21.041Z",
* "earliestEndDate": "2026-04-27T09:49:21.041Z",
* "formData": {
* "submissionData": {}
* },
* "freeTrialDays": 90,
* "orderMethod": "UNKNOWN",
* "pausePeriods": [],
* "planDescription": "3 mo free trial with discount for 1 year",
* "planId": "cb4a8c57-273a-4567-94e3-cc43d5d339f2",
* "planName": "Beginner's Plan",
* "planPrice": "50",
* "priceDetails": {
* "currency": "USD",
* "discount": "0",
* "fees": [],
* "freeTrialDays": 90,
* "planPrice": "50",
* "subtotal": "50.00",
* "total": "50.00",
* "subscription": {
* "cycleCount": 2,
* "cycleDuration": {
* "count": 1,
* "unit": "YEAR"
* }
* }
* },
* "pricing": {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 2
* },
* "price": {
* "currency": "USD",
* "discount": "0",
* "fees": [],
* "proration": "0",
* "subtotal": "50.00",
* "total": "50.00"
* }
* }
* ],
* "subscription": {
* "cycleCount": 2,
* "cycleDuration": {
* "count": 1,
* "unit": "YEAR"
* }
* }
* },
* "startDate": "2024-01-28T09:49:21.041Z",
* "status": "ACTIVE",
* "statusNew": "ACTIVE",
* "subscriptionId": "305f8fc9-3724-4cac-9f67-4e29f2c46def",
* "type": "OFFLINE",
* "wixPayOrderId": "2f0e79d8-f15d-46c6-ac1a-10ec7a2030fb"
* }
* },
* "metadata": {
* "entityId": "82d99338-5653-459a-a751-b57483f7cfb5",
* "eventTime": "2024-02-07T13:22:47.641175778Z",
* "id": "ef926c78-1c7a-4ffd-a8c4-fa59bdcf09c1",
* "triggeredByAnonymizeRequest": false
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.