requestCurrentMemberOrderCancellation( )
Starts the process of cancelling the logged-in member's pricing plan order.
Description
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.
Syntax
function requestCurrentMemberOrderCancellation(orderId: string, effectiveAt: string): Promise<void>
requestCurrentMemberOrderCancellation Parameters
NAME
TYPE
DESCRIPTION
ID of the order whose cancellation is requested.
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.
Returns
Fulfilled - When the cancellation process is started.
Return Type:
Related Content:
Was this helpful?
Start the cancellation process for the currently logged-in member's order
1import { Permissions, webMethod } from 'wix-web-module';2import { orders } from 'wix-pricing-plans-backend';34// Sample orderId value: 'a8c4a1b2-b5e8-4b33-9693-057ec93e9a27'5//6// Sample effectiveAt value: 'IMMEDIATELY'78export const myRequestCurrentMemberCancelFunction = webMethod(Permissions.Anyone, async (orderId, effectiveAt) => {9 try {10 const order = await orders.requestCurrentMemberOrderCancellation(orderId, effectiveAt);1112 return order;13 } catch (error) {14 console.error(error);15 }16});1718// Returns a promise that resolves to void