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 totrue
.
Syntax
function postponeEndDate(orderId: string, endDate: Date, [options: Options]): Promise<void>
postponeEndDate Parameters
NAME
TYPE
DESCRIPTION
ID of the order whose end date must change.
New date and time to update the endDate at which the order will expire.
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:
Related Content:
Was this helpful?
1import { orders } from 'wix-pricing-plans-backend';23// Sample orderId value: '5bc6d668-f09f-4f1d-98f2-289d4c209f2b'4//5// Sample endDate value: new Date('November 1, 2022 10:00:00')67export async function myPostponeEndDateFunction(orderId) {8 try {9 const order = await orders.postponeEndDate(orderId, endDate);1011 return order;12 } catch (error) {13 console.error(error);14 }15}1617// Returns a promise that resolves to void
1import { orders } from 'wix-pricing-plans-backend';23/* Sample orderId value: '895fd8d9-f732-444f-a82b-19f7e55e9617'4 *5 * Sample endDate value: new Date('Fri Jul 22 2022 17:50:26')6 *7 * Sample options object:8 * {9 * suppressAuth : true10 * }11 */1213export async function myPostponeEndDateWithOptionsFunction(orderId, endDate, options) {14 try {15 const order = await orders.postponeEndDate(orderId, endDate, options);1617 return order;18 } catch (error) {19 console.error(error);20 }21}2223// Returns a promise that resolves to void