Search.../

postponeEndDate( )

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.

The onOrderEndDatePostponed() and onOrderUpdated() event handlers run when an order's end date is postponed or made earlier.

Note: Only site visitors with the Manage Pricing Plans and Manage Subscriptions permissions can change the end date of orders. You can override the permissions by setting the function's suppressAuth option to true.

Syntax

function postponeEndDate(orderId: string, endDate: Date, [options: Options]): Promise<void>

postponeEndDate Parameters

NAME
TYPE
DESCRIPTION
orderId
string

ID of the order whose end date must change.

endDate
Date

New date and time to update the endDate at which the order will expire.

options
Optional
Options

Options to use when changing the end date of an order.

Returns

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

Return Type:

Promise<void>

Was this helpful?

Postpone the end of an order to a later date

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { orders } from 'wix-pricing-plans-backend';
3
4// Sample orderId value: '5bc6d668-f09f-4f1d-98f2-289d4c209f2b'
5//
6// Sample endDate value: new Date('November 1, 2022 10:00:00')
7
8export const myPostponeEndDateFunction = webMethod(Permissions.Anyone, async (orderId, endDate) => {
9 try {
10 const order = await orders.postponeEndDate(orderId, endDate);
11
12 return order;
13 } catch (error) {
14 console.error(error);
15 }
16});
17
18// Returns a promise that resolves to void
Bring the end of an order forward to an earlier date, bypassing permission checks

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { orders } from 'wix-pricing-plans-backend';
3
4/* Sample orderId value: '895fd8d9-f732-444f-a82b-19f7e55e9617'
5 *
6 * Sample endDate value: new Date('Fri Jul 22 2022 17:50:26')
7 *
8 * Sample options object:
9 * {
10 * suppressAuth : true
11 * }
12 */
13
14export const myPostponeEndDateWithOptionsFunction = webMethod(Permissions.Anyone, async (orderId, endDate, options) => {
15 try {
16 const order = await orders.postponeEndDate(orderId, endDate, options);
17
18 return order;
19 } catch (error) {
20 console.error(error);
21 }
22});
23
24// Returns a promise that resolves to void