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.
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
Order ID.
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:
Was this helpful?
1import { orders } from 'wix-pricing-plans-backend';2import { elevate } from 'wix-auth';34/* Sample _id value: '82d99338-5653-459a-a751-b57483f7cfb5'5 *6 * Sample endDate value: new Date('June 30, 2026 04:00:00')7 */89const elevatedPostponeEndDate = elevate(orders.postponeEndDate);1011export async function myPostponeEndDateFunction(_id, endDate) {12 try {13 await elevatedPostponeEndDate(_id, endDate);1415 return;16 } catch (error) {17 console.error(error);18 // Handle the error19 }20}2122/* Promise that resolves to void */
1import { Permissions, webMethod } from 'wix-web-module';2import { orders } from 'wix-pricing-plans-backend';3import { elevate } from 'wix-auth';45/*6 * Sample _id value: '82d99338-5653-459a-a751-b57483f7cfb5'7 *8 * Sample endDate value: new Date('June 30, 2026 04:00:00')9 */1011const elevatedPostponeEndDate = elevate(orders.postponeEndDate);1213export const myPostponeEndDateFunction = webMethod(Permissions.Anyone, async (_id, endDate) => {14 try {15 await elevatedPostponeEndDate(_id, endDate);1617 return;18 } catch (error) {19 console.error(error);20 // Handle the error21 }22});2324/* Promise that resolves to void */25