Search.../

pauseOrder( )

Developer Preview

Pauses a pricing plan 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. You 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.

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

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function pauseOrder(_id: string): Promise<void>

pauseOrder Parameters

NAME
TYPE
DESCRIPTION
_id
string

Order ID.

Returns

Fulfilled - When the order is paused.

Return Type:

Promise<
void
>

Was this helpful?

Pause a pricing plan order

Copy Code
1import { orders } from 'wix-pricing-plans.v2';
2import { elevate } from 'wix-auth';
3
4/* Sample _id value: '9af3cbe6-fe27-4fdb-a0b0-892289b03d22' */
5
6const elevatedPauseOrder = elevate(orders.pauseOrder);
7
8export async function pauseOrder(_id) {
9 try {
10 await elevatedPauseOrder(_id);
11
12 return;
13 } catch (error) {
14 console.error(error);
15 // Handle the error
16 }
17}
18
19/* Promise resolves to void */