> 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: sitePricingPlans.requestCurrentMemberOrderCancellation(orderId: string, effectiveAt: string) # Method Link: https://dev.wix.com/docs/sdk/frontend-modules/pricing-plans/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 Permissions: # Method Permissions Scopes IDs: undefined # Method Code Examples: ## Request cancellation of an order on button click ```javascript import { orders } from '@wix/site-pricing-plans'; // 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/site-pricing-plans'; import { items } from "@wix/data"; import { currentMember } from "@wix/site-members"; import { window } from "@wix/site-window"; $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(async () => { // Let user know that cancellation succeeded await window.openLightbox('orderCanceled'); // Get details for updating status of existing subscription const member = await currentMember.getMember(); const toUpdate = { _id: subscription._id, planName: subscription.planName, planId: subscription.planId, orderId: subscription.orderId, memberId: subscription.user.id, dateCreated: subscription.dateCreated, canceled: true, // Set cancellation to true dateUpdated: Date().toString() }; // Update subscription in collection to show the subscription is canceled items.update('Subscriptions', toUpdate); }) // Let user know if cancellation failed .catch(async (error) => { await window.openLightbox('cancelFailed'); }); }); }); }); ```