> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: requestCurrentMemberOrderCancellation(orderId: string, effectiveAt: string) # Method package: wixPricingPlansFrontend # Method menu location: wixPricingPlansFrontend --> Orders --> requestCurrentMemberOrderCancellation # Method Link: https://dev.wix.com/docs/velo/apis/wix-pricing-plans-frontend/orders/request-current-member-order-cancellation.md # Method Description: Requests the cancellation of a specific order of a plan for the currently logged-in member. `requestCurrentMemberOrderCancellation()` requests the cancellation of an order, after verifying that the site member is logged in. This method doesn't immediately cancel the order. The cancellation request is initiated and the `status` of the order is updated to `"PENDING_CANCELLATION"`. When the cancellation is completed, the order status is updated to `"CANCELED"`. Keep in mind that a site member can order several subscriptions of the same plan. This API doesn't cancel the plan and remove all corresponding subscriptions. This API removes only the one specified order of the plan. If a plan's [Allow Plan Cancellation](https://support.wix.com/en/article/pricing-plans-allowing-clients-to-cancel-plans) setting is disabled and the currently logged-in site member tries to cancel an order for the plan using `requestCurrentMemberOrderCancellation()`, an error is thrown. > **Note**: > + To work with the Pricing Plans API, a site needs to be published. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Request cancellation of an order on button click ```javascript import { orders } from 'wix-pricing-plans-frontend'; // Sample orderId value: 'e9667014-b773-40b1-871d-041cedd9302d' // // Sample effectiveAt value: 'IMMEDIATELY' $w('#cancelMyOrderButton').onClick((event) => { orders.requestCurrentMemberOrderCancellation(orderId, effectiveAt) .then(() => { console.log('Order cancellation requested.'); }) .catch((error) => { console.error(error); }); }); ``` ## A full cancel order request scenario ```javascript import { orders } from 'wix-pricing-plans-frontend'; import wixData from 'wix-data'; import wixMembersFrontend from 'wix-members-frontend'; import wixWindowFrontend from 'wix-window-frontend'; $w.onReady(function () { $w('#subscriptionDataset').onReady( () => { // Get the order ID for the subscription to cancel const subscription = $w('#subscriptionDataset').getCurrentItem(); const orderId = subscription.orderId; $w('cancelButton').onClick((event) => { // Cancel the specific subscription of the plan immediately orders.requestCurrentMemberOrderCancellation(orderId, "IMMEDIATELY") .then(() => { // Let user know that cancellation succeeded wixWindowFrontend.openLightbox('orderCanceled'); // Get details for updating status of existing subscription const member = wixMembersFrontend.currentMember; const toUpdate = { _id: subscription._id, planName: subscription.planName, planId: subscription.planId, orderId: subscription.orderId, memberId: user.id, dateCreated: subscription.dateCreated, canceled: true, // Set cancellation to true dateUpdated: Date().toString() }; // Update subscription in collection to show the subscription is canceled wixData.update('Subscriptions', toUpdate); }) // Let user know if cancellation failed .catch((error) => { wixWindowFrontend.openLightbox('cancelFailed'); }); }); }); }); ``` ---