Lists orders for the currently logged-in member.
The listCurrentMemberOrders()
function returns a Promise that resolves to a list of up to 100 pricing plan orders.
You can specify options for filtering, sorting, and paginating the results.
function listCurrentMemberOrders(
filters: CurrentMemberFilterOptions,
sorting: SortingOptions,
paging: PaginationOptions,
): Promise<Array<Order>>;
Filter options for limiting which orders are listed.
Sorting options, such as by which property and in which direction.
Pagination options, such as how many results are listed at a time.
import { Permissions, webMethod } from "wix-web-module";
import { orders } from "wix-pricing-plans-backend";
/* Sample filters object:
* {
* orderStatuses: ['PAUSED', 'CANCELED']
* }
*/
/* Sample sorting object:
* {
* fieldName: ['createdDate'],
* order: ['ASC']
* }
*/
/* Sample paging object:
* {
* limit: 3,
* skip: 1
* }
*/
export const myListCurrentMemberOrdersFunction = webMethod(
Permissions.Anyone,
async (filters, sorting, paging) => {
try {
const listedOrders = await orders.listCurrentMemberOrders(
filters,
sorting,
paging,
);
const firstOrderId = listedOrders.orders[0]._id;
const firstOrderStatus = listedOrders.orders[0].status;
return listedOrders;
} catch (error) {
console.error(error);
}
},
);
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.