Search.../

requestCancellation( )

Starts the process of canceling an order.

Description

The requestCancellation() function returns a Promise that resolves when the order cancellation is successfully requested.

For orders with recurring payments, a cancellation can be set to occur either immediately or at the next payment date. For orders with one-time payments, a cancellation occurs immediately after the request is processed.

Requesting an order cancellation starts the cancellation process. There may be some operations that continue to be processed before the status of the order is changed to "CANCELED". For example, payments might need to be refunded before the order is fully canceled.

Syntax

function requestCancellation(_id: string, effectiveAt: string): Promise<void>

requestCancellation Parameters

NAME
TYPE
DESCRIPTION
_id
string

Order ID.

effectiveAt
string

Whether to cancel the order immediately or at the next payment date. One-time payment orders can only be canceled immediately.

Supported values:

  • "IMMEDIATELY": Indicates that the order should be canceled immediately.
  • "NEXT_PAYMENT_DATE": Indicates that the order be canceled at the next payment date.

Returns

Fulfilled - When the cancellation process is started.

Return Type:

Promise<
void
>

Was this helpful?

requestCancellation example

Copy Code
1import { orders } from 'wix-pricing-plans.v2';
2
3 async function requestCancellation(id, effectiveAt) {
4 try {
5 const result = await orders.requestCancellation(id, effectiveAt);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13