> 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: managementListOrders(options: ManagementListOrdersOptions) # Method package: wixPricingPlansV2 # Method menu location: wixPricingPlansV2 --> orders --> managementListOrders # Method Link: https://dev.wix.com/docs/velo/apis/wix-pricing-plans-v2/orders/management-list-orders.md # Method Description: Retrieves a list of up to 50 pricing plan orders and details, given the specified sorting and filtering. By default, this endpoint will retrieve all orders and return them sorted by `createdDate` in `DESC`, descending order. `sort.fieldName` supports `endDate` and `createdDate` fields and defaults to `ASC`, ascending order. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## List pricing plan orders (dashboard page code) ```javascript import { orders } from 'wix-pricing-plans.v2'; import { elevate } from 'wix-auth'; const elevatedManagementListOrders = elevate(orders.managementListOrders); export async function myManagementListOrdersFunction() { try { const ordersList = await elevatedManagementListOrders(); return ordersList; } catch (error){ console.error(error); // Handle the error } } /* Promise resolves to: * { * "orders": [ * { * "_createdDate": "2024-01-22T14:00:53.904Z", * "_id": "14fac8ae-506e-4e7b-84d4-e9b094d0ddca", * "_updatedDate": "2024-01-22T14:00:54.772Z", * "buyer": { * "contactId": "f5691fc2-0674-4eee-92c5-da06a05981a5", * "memberId": "f5691fc2-0674-4eee-92c5-da06a05981a5" * }, * "currentCycle": { * "index": 1, * "startedDate": "2024-01-22T14:00:53.904Z" * }, * "cycles": [ * { * "index": 1, * "startedDate": "2024-01-22T14:00:53.904Z" * } * ], * "formData": { * "submissionData": {} * }, * "lastPaymentStatus": "NOT_APPLICABLE", * "orderMethod": "UNKNOWN", * "pausePeriods": [], * "planDescription": "", * "planId": "aa0d8e0e-99ad-4c95-ac48-4955e37956c5", * "planName": "Default", * "planPrice": "0", * "priceDetails": { * "currency": "EUR", * "discount": "0", * "planPrice": "0", * "singlePaymentUnlimited": true, * "subtotal": "0.00", * "total": "0" * }, * "pricing": { * "prices": [ * { * "duration": { * "cycleFrom": 1, * "numberOfCycles": 1 * }, * "price": { * "currency": "EUR", * "discount": "0", * "fees": [], * "proration": "0", * "subtotal": "0.00", * "total": "0" * } * } * ], * "singlePaymentUnlimited": true * }, * "priceDetails": { * "currency": "EUR", * "discount": "0", * "planPrice": "0", * "singlePaymentUnlimited": true, * "subtotal": "0.00", * "total": "0" * }, * "startDate": "2024-01-22T14:00:53.904Z", * "status": "ACTIVE", * "statusNew": "ACTIVE", * "subscriptionId": "19276032-d06f-4931-962f-79486d8b6bc0", * "type": "ONLINE" * } * ], * "pagingMetadata": { * "count": 1, * "hasNext": false, * "offset": 0, * "total": 1 * } * } */ ``` ## List pricing plan orders (export from backend code) ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { orders } from 'wix-pricing-plans.v2'; import { elevate } from 'wix-auth'; const elevatedManagementListOrders = elevate(orders.managementListOrders); export const myManagementListOrdersFunction = webMethod(Permissions.Anyone, async () => { try { const ordersList = await elevatedManagementListOrders(); return ordersList; } catch (error){ console.error(error); // Handle the error } }); /* Promise resolves to: * { * "orders": [ * { * "_createdDate": "2024-01-22T14:00:53.904Z", * "_id": "14fac8ae-506e-4e7b-84d4-e9b094d0ddca", * "_updatedDate": "2024-01-22T14:00:54.772Z", * "buyer": { * "contactId": "f5691fc2-0674-4eee-92c5-da06a05981a5", * "memberId": "f5691fc2-0674-4eee-92c5-da06a05981a5" * }, * "currentCycle": { * "index": 1, * "startedDate": "2024-01-22T14:00:53.904Z" * }, * "cycles": [ * { * "index": 1, * "startedDate": "2024-01-22T14:00:53.904Z" * } * ], * "formData": { * "submissionData": {} * }, * "lastPaymentStatus": "NOT_APPLICABLE", * "orderMethod": "UNKNOWN", * "pausePeriods": [], * "planDescription": "", * "planId": "aa0d8e0e-99ad-4c95-ac48-4955e37956c5", * "planName": "Default", * "planPrice": "0", * "priceDetails": { * "currency": "EUR", * "discount": "0", * "planPrice": "0", * "singlePaymentUnlimited": true, * "subtotal": "0.00", * "total": "0" * }, * "pricing": { * "prices": [ * { * "duration": { * "cycleFrom": 1, * "numberOfCycles": 1 * }, * "price": { * "currency": "EUR", * "discount": "0", * "fees": [], * "proration": "0", * "subtotal": "0.00", * "total": "0" * } * } * ], * "singlePaymentUnlimited": true * }, * "priceDetails": { * "currency": "EUR", * "discount": "0", * "planPrice": "0", * "singlePaymentUnlimited": true, * "subtotal": "0.00", * "total": "0" * }, * "startDate": "2024-01-22T14:00:53.904Z", * "status": "ACTIVE", * "statusNew": "ACTIVE", * "subscriptionId": "19276032-d06f-4931-962f-79486d8b6bc0", * "type": "ONLINE" * } * ], * "pagingMetadata": { * "count": 1, * "hasNext": false, * "offset": 0, * "total": 1 * } * } */ ``` ## List pricing plan orders with options ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { orders } from 'wix-pricing-plans.v2'; import { elevate } from 'wix-auth'; /* Sample options value: * { * autoRenewCanceled: false, * buyerIds: [ * '402ec90c-235a-45c4-b4cc-52204d5f6b00', * '3fc889f6-18e8-4fd9-a509-27db9f037f26', * 'fa16f1dc-0fbd-41c0-8efc-53333e3fce1e', * '554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4', * '695568ff-1dc2-49ff-83db-2b518d35692b', * '554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4', * 'f5691fc2-0674-4eee-92c5-da06a05981a5' * ], * fieldSet: 'BASIC', * limit: 3, * offset: 0, * orderStatuses: [ * 'ACTIVE' * ], * paymentStatus: [ * 'PAID', * 'NOT_APPLICABLE' * ], * planIds: [ * '0da57ac8-c3d0-4687-8aea-4100781b6386', * 'df83348a-777d-46ab-8d62-a43c415bdb11', * '3a3e0ac2-a9e3-4bfd-ade3-bec3bab34d4b', * 'cb4a8c57-273a-4567-94e3-cc43d5d339f2', * 'df83348a-777d-46ab-8d62-a43c415bdb11', * 'aa0d8e0e-99ad-4c95-ac48-4955e37956c5', * 'aa0d8e0e-99ad-4c95-ac48-4955e37956c5' * ], * sorting: { * fieldName: 'createdDate', * order: 'ASC' * }; */ const elevatedManagementListOrders = elevate(orders.managementListOrders); export const myManagementListOrdersFunction = webMethod(Permissions.Anyone, async (options) => { try { const ordersList = await elevatedManagementListOrders(options); return ordersList; } catch (error) { console.error(error); // Handle the error } }); /* Promise resolves to: * { * "orders": [ * { * "_createdDate": "2024-01-28T09:49:21.041Z", * "_id": "82d99338-5653-459a-a751-b57483f7cfb5", * "_updatedDate": "2024-02-04T10:42:58.888Z", * "autoRenewCanceled": false, * "buyer": { * "contactId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4", * "memberId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4" * }, * "currentCycle": { * "endedDate": "2024-04-27T09:49:21.041Z", * "index": 0, * "startedDate": "2024-01-28T09:49:21.041Z" * }, * "cycles": [ * { * "endedDate": "2024-04-27T09:49:21.041Z", * "index": 0, * "startedDate": "2024-01-28T09:49:21.041Z" * } * ], * "endDate": "2026-07-29T09:49:21.041Z", * "earliestEndDate": "2026-04-27T09:49:21.041Z", * "formData": { * "submissionData": {} * }, * "freeTrialDays": 90, * "lastPaymentStatus": "PAID", * "orderMethod": "UNKNOWN", * "pausePeriods": [], * "planDescription": "3 mo free trial with discount for 1 year", * "planId": "cb4a8c57-273a-4567-94e3-cc43d5d339f2", * "planName": "Beginner's Plan", * "planPrice": "50", * "priceDetails": { * "currency": "USD", * "discount": "0", * "freeTrialDays": 90, * "planPrice": "50", * "subtotal": "50.00", * "total": "50.00" * }, * "pricing": { * "prices": [ * { * "duration": { * "cycleFrom": 1, * "numberOfCycles": 2 * }, * "price": { * "currency": "USD", * "discount": "0", * "fees": [], * "proration": "0", * "subtotal": "50.00", * "total": "50.00" * } * } * ], * "singlePaymentUnlimited": true * }, * "startDate": "2024-01-28T09:49:21.041Z", * "status": "ACTIVE", * "statusNew": "ACTIVE", * "subscriptionId": "305f8fc9-3724-4cac-9f67-4e29f2c46def", * "type": "OFFLINE", * "wixPayOrderId": "2f0e79d8-f15d-46c6-ac1a-10ec7a2030fb" * } * ], * "pagingMetadata": { * "count": 1, * "hasNext": false, * "offset": 0, * "total": 1 * } * } */ ``` ## Manager cancellation or updated payment status of multiple orders ```javascript /******************************* * Backend code - utils.web.js * *******************************/ import { Permissions, webMethod } from 'wix-web-module'; import { orders } from 'wix-pricing-plans.v2'; import { elevate } from 'wix-auth'; const elevatedManagementListOrders = elevate(orders.managementListOrders); const elevatedCancelOrder = elevate(orders.cancelOrder); const elevatedMarkAsPaid = elevate(orders.markAsPaid); export const getUnpaidOrders = webMethod( Permissions.Anyone, async () => { const options = { paymentStatuses: 'UNPAID' }; try { const ordersList = await elevatedManagementListOrders(options); return ordersList; } catch (error) { console.error(error); // Handle the error } }); export const cancelOrder = webMethod( Permissions.Anyone, async (orderId) => { const effectiveAt = 'NEXT_PAYMENT_DATE'; try { await elevatedCancelOrder(orderId, effectiveAt); return; } catch (error) { console.error(error); // Handle the error } }); export const markAsPaid = webMethod( Permissions.Anyone, async (orderId) => { try { await elevatedMarkAsPaid(orderId); return; } catch (error) { console.error(error); // Handle the error } }); /************* * Page code * *************/ import { getUnpaidOrders, cancelOrder, markAsPaid } from 'backend/utils.web'; $w.onReady(function () { $w('#ordersCheckbox').hide(); $w('#markAsPaidBtn').disable(); $w('#cancelOrderBtn').disable(); populateOrdersCheckbox(); let orderValues; $w('#ordersCheckbox').onChange(() => { orderValues = $w('#ordersCheckbox').value; }); // Cancel multiple orders $w('#cancelOrderBtn').onClick(() => { orderValues.forEach(async (orderId) => { await cancelOrder(orderId); }); }); // Mark multiple orders as paid $w('#markAsPaidBtn').onClick(() => { orderValues.forEach(async (orderId) => { await markAsPaid(orderId); }); }); }); async function populateOrdersCheckbox() { const unpaidOrders = await getUnpaidOrders(); // Displays each order with its corresponding member ID $w('#ordersCheckbox').options = unpaidOrders.orders.map(item => { return { label: `${item.planName} - memberId: ${item.buyer.memberId}`, value: item._id } }); $w('#ordersCheckbox').show(); $w('#markAsPaidBtn').enable(); $w('#cancelOrderBtn').enable(); } ``` ---