Search.../

pauseOrder( )

Pauses a pricing plans order.

Description

The pauseOrder() function returns a Promise that resolves when the order is successfully paused.

For orders with recurring payments, pauseOrder() also pauses the payment schedule. Buyers are not charged when an order is paused. Use pauseOrder(), for example, if the buyer is away and would like to put their pricing plan membership on hold until they return. Pausing an order affects the end date of the order by adding the time the order is paused to the endDate. Can only pause orders with an ACTIVE status.

Pausing an order causes the following changes:

  • The order status changes to "PAUSED".
  • The pausePeriods array is updated.

The endDate and the earliestEndDate for the order are adjusted to include the pause period when the order is resumed.

The onOrderPaused() and onOrderUpdated() event handlers run when an order is paused.

Paused orders can be continued with the resumeOrder() function.

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

Syntax

function pauseOrder(orderId: string, [options: Options]): Promise<void>

pauseOrder Parameters

NAME
TYPE
DESCRIPTION
orderId
string

ID of the order being paused.

options
Optional
Options

Options to use when pausing an order.

Returns

Fulfilled - When the order is paused.

Return Type:

Promise<void>

Was this helpful?

Pause an order

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { orders } from 'wix-pricing-plans-backend';
3
4// Sample orderId value: '19b28b41-1ef2-42dc-afaa-9dc1854d0191'
5
6export const myPauseOrderFunction = webMethod(Permissions.Anyone, async (orderId) => {
7 try {
8 const order = await orders.pauseOrder(orderId);
9
10 return order;
11 } catch (error) {
12 console.error(error);
13 }
14});
15
16// Returns a promise that resolves to void
Pause an order, 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 options object:
7 * {
8 * suppressAuth : true
9 * }
10 */
11
12export const myPauseOrderWithOptionsFunction = webMethod(Permissions.Anyone, async (orderId, options) => {
13 try {
14 const order = await orders.pauseOrder(orderId, options);
15
16 return order;
17 } catch (error) {
18 console.error(error);
19 }
20});
21
22// Returns a promise that resolves to void