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
.
Authorization
Request
This endpoint does not take any parameters
Response Object
Fulfilled - When the order's end date has been postponed or made earlier.
Returns an empty object.
Status/Error Codes
Related Content:
Was this helpful?
1import { Permissions, webMethod } from 'wix-web-module';2import { orders } from 'wix-pricing-plans-backend';34// Sample orderId value: '5bc6d668-f09f-4f1d-98f2-289d4c209f2b'5//6// Sample endDate value: new Date('November 1, 2022 10:00:00')78export const myPostponeEndDateFunction = webMethod(Permissions.Anyone, async (orderId, endDate) => {9 try {10 const order = await orders.postponeEndDate(orderId, endDate);1112 return order;13 } catch (error) {14 console.error(error);15 }16});1718// Returns a promise that resolves to void
1import { Permissions, webMethod } from 'wix-web-module';2import { orders } from 'wix-pricing-plans-backend';34/* 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 : true11 * }12 */1314export const myPostponeEndDateWithOptionsFunction = webMethod(Permissions.Anyone, async (orderId, endDate, options) => {15 try {16 const order = await orders.postponeEndDate(orderId, endDate, options);1718 return order;19 } catch (error) {20 console.error(error);21 }22});2324// Returns a promise that resolves to void