requestCurrentMemberOrderCancellation( )


Starts the process of cancelling the logged-in member's pricing plan order.

The requestCurrentMemberOrderCancellation() 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. The event is triggered immediately and the function's promise is fulfilled. However, 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.

The onOrderUpdated() event handler runs when a cancellation is requested. The onOrderCanceled() event handler runs when the cancellation is completed.

Method Declaration
Copy
function requestCurrentMemberOrderCancellation(
  orderId: string,
  effectiveAt: string,
): Promise<void>;
Method Parameters
orderIdstringRequired

ID of the order whose cancellation is requested.


effectiveAtstringRequired

The request can be that the order is canceled immediately or at the next payment date. One-time orders can only be canceled immediately. One of:

  • "IMMEDIATELY" The request indicates that the order should be canceled immediately.
  • "NEXT_PAYMENT_DATE". The request indicates that the order be canceled at the next payment date.
Start the cancellation process for the currently logged-in member's order
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { orders } from "wix-pricing-plans-backend"; // Sample orderId value: 'a8c4a1b2-b5e8-4b33-9693-057ec93e9a27' // // Sample effectiveAt value: 'IMMEDIATELY' export const myRequestCurrentMemberCancelFunction = webMethod( Permissions.Anyone, async (orderId, effectiveAt) => { try { const order = await orders.requestCurrentMemberOrderCancellation( orderId, effectiveAt, ); return order; } catch (error) { console.error(error); } }, ); // Returns a promise that resolves to void
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?