Lists the orders for the currently logged-in member.
The listsCurrentMemberOrders()
function returns a Promise that resolves to an
array of the non-draft orders for the currently logged-in member.
Note:
To work with the Pricing Plans API, you need to publish your site.
The listCurrentMemberOrders()
function doesn't work in preview mode.
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 { orders } from "wix-pricing-plans-frontend";
$w("#myListOrdersButton").onClick((event) => {
orders
.listCurrentMemberOrders()
.then((ordersList) => {
const firstOrder = ordersList[0];
const firstOrderStatus = ordersList[0].status;
console.log("Your orders:", ordersList);
return ordersList;
})
.catch((error) => {
console.error(error);
});
});
/* In this case, a `myOrderList` array of two order items:
* [
* {
* "_id": "d9667014-b773-40b1-871d-041cedd9302e",
* "planId": "60f0e90f-06f6-4b9c-8cd7-5a02d015d98b",
* "subscriptionId": "14e11d7d-46e2-46be-a8a0-5484f595701c",
* "buyer": {
* "memberId": "0c9bca47-1f00-4b92-af1c-7852452e949a",
* "contactId": "0c9bca47-1f00-4b92-af1c-7852452e949a"
* },
* "priceDetails": {
* "subtotal": "0",
* "discount": "0",
* "total": "0",
* "planPrice": "0",
* "currency": "EUR",
* "singlePaymentForDuration": {
* "count": 1,
* "unit": "MONTH"
* }
* },
* "pricing": {
* "singlePaymentForDuration": {
* "count": 1,
* "unit": "MONTH"
* },
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 1
* },
* "price": {
* "subtotal": "0",
* "discount": "0",
* "total": "0",
* "currency": "EUR"
* }
* }
* ]
* },
* "type": "ONLINE",
* "orderMethod": "UNKNOWN",
* "status": "PENDING",
* "lastPaymentStatus": "NOT_APPLICABLE",
* "startDate": "2022-08-25T07:44:00.000Z",
* "endDate": "2022-09-25T07:44:00.000Z",
* "pausePeriods": [],
* "earliestEndDate": "2022-09-25T07:44:00.000Z",
* "planName": "Free Trial",
* "planDescription": "Come try it out!",
* "planPrice": "0",
* "_createdDate": "2022-08-23T23:57:36.745Z",
* "_updatedDate": "2022-08-23T23:57:37.126Z"
* },
* {
* "_id": "a8c4a1b2-b5e8-4b33-9693-057ec93e9a27",
* "planId": "099e2c86-3b7e-4477-8c27-f77402b8cceb",
* "subscriptionId": "f0cd38ff-a0a5-403c-9882-454e6badf64b",
* "wixPayOrderId": "ad363d3d-dc48-45cf-8454-62bee1e750e9",
* "buyer": {
* "memberId": "0c9bca47-1f00-4b92-af1c-7852452e949a",
* "contactId": "0c9bca47-1f00-4b92-af1c-7852452e949a"
* },
* "priceDetails": {
* "subtotal": "74.99",
* "discount": "0",
* "total": "74.99",
* "planPrice": "74.99",
* "currency": "EUR",
* "subscription": {
* "cycleDuration": {
* "count": 1,
* "unit": "MONTH"
* },
* "cycleCount": 3
* }
* },
* "pricing": {
* "subscription": {
* "cycleDuration": {
* "count": 1,
* "unit": "MONTH"
* },
* "cycleCount": 3
* },
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 3
* },
* "price": {
* "subtotal": "74.99",
* "discount": "0",
* "total": "74.99",
* "currency": "EUR"
* }
* }
* ]
* },
* "type": "OFFLINE",
* "orderMethod": "UNKNOWN",
* "status": "CANCELED",
* "autoRenewCanceled": true,
* "cancellation": {
* "cause": "OWNER_ACTION",
* "effectiveAt": "IMMEDIATELY"
* },
* "lastPaymentStatus": "PAID",
* "startDate": "2022-07-22T17:50:26.000Z",
* "endDate": "2022-07-22T13:00:21.694Z",
* "pausePeriods": [],
* "earliestEndDate": "2022-10-22T17:50:26.000Z",
* "planName": "Platinum Pro",
* "planDescription": "",
* "planPrice": "74.99",
* "_createdDate": "2022-07-22T12:30:48.472Z",
* "_updatedDate": "2022-07-22T13:00:21.785Z"
* }
* ]
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.