Search.../

postponeEndDate( )

Developer Preview

Extends the duration of a pricing plan order by postponing the order's endDate.

Description

The postponeEndDate() function returns a Promise that resolves when the order's end date is successfully changed.

The new end date and time must be later than the order's current endDate.

Postponing the end date of an order does not impact payments. For example, if the pricing plan is for a membership to an online lecture series, and you want to extend the duration of the series because the lecturer could not attend some sessions, you can postpone the end date of the orders for all relevant participants. The participants will not be billed additionally.

Postponing an order causes the following changes:

  • The endDate for the order is adjusted to the new end date.
Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function postponeEndDate(_id: string, endDate: Date): Promise<void>

postponeEndDate Parameters

NAME
TYPE
DESCRIPTION
_id
string

Order ID.

endDate
Date

New end date and time.

Must be later than the current end date and time.

Returns

Fulfilled - When the order's end date has been postponed or made earlier.

Return Type:

Promise<
void
>

Was this helpful?

Postpone an order's end date (dashboard page code)

Copy Code
1import { orders } from 'wix-pricing-plans-backend';
2import { elevate } from 'wix-auth';
3
4/* Sample _id value: '82d99338-5653-459a-a751-b57483f7cfb5'
5 *
6 * Sample endDate value: new Date('June 30, 2026 04:00:00')
7 */
8
9const elevatedPostponeEndDate = elevate(orders.postponeEndDate);
10
11export async function myPostponeEndDateFunction(_id, endDate) {
12 try {
13 await elevatedPostponeEndDate(_id, endDate);
14
15 return;
16 } catch (error) {
17 console.error(error);
18 // Handle the error
19 }
20}
21
22/* Promise that resolves to void */
Postpone an order's end date (export from backend code)

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { orders } from 'wix-pricing-plans-backend';
3import { elevate } from 'wix-auth';
4
5/*
6 * Sample _id value: '82d99338-5653-459a-a751-b57483f7cfb5'
7 *
8 * Sample endDate value: new Date('June 30, 2026 04:00:00')
9 */
10
11const elevatedPostponeEndDate = elevate(orders.postponeEndDate);
12
13export const myPostponeEndDateFunction = webMethod(Permissions.Anyone, async (_id, endDate) => {
14 try {
15 await elevatedPostponeEndDate(_id, endDate);
16
17 return;
18 } catch (error) {
19 console.error(error);
20 // Handle the error
21 }
22});
23
24/* Promise that resolves to void */
25