Search.../

listCurrentMemberOrders( )

Lists the orders for the currently logged-in member.

Description

The listsCurrentMemberOrders() function returns a Promise that resolves to an array of the non-draft orders for the currently logged-in member.

Notes:

  • The pricing plan listCurrentMemberOrders() function replaces the deprecated paid plans getCurrentMemberOrders() function. The deprecated function will continue to work, but will not receive updates. To keep any existing code compatible with future changes, see the migration instructions.

  • To work with the Pricing Plans API, you need to publish your site.

  • The listCurrentMemberOrders() function doesn't work in preview mode.

Syntax

function listCurrentMemberOrders([filters: CurrentMemberFilterOptions], [sorting: SortingOptions], [paging: PaginationOptions]): Promise<Array<Order>>

listCurrentMemberOrders Parameters

NAME
TYPE
DESCRIPTION
filters
Optional
CurrentMemberFilterOptions

Filter options for limiting which orders are listed.

sorting
Optional
SortingOptions

Sorting options, such as by which property and in which direction.

paging
Optional
PaginationOptions

Pagination options, such as how many results are listed at a time.

Returns

Fulfilled - An array of order objects for the currently logged-in member. Rejected - Error message.

Return Type:

Promise<Array<Order>>
NAME
TYPE
DESCRIPTION
_id
string

Order ID.

planId
string

ID of the plan that was ordered.

subscriptionId
string

ID of the related Wix subscription.

Every pricing plan order corresponds to a Wix subscription, including orders for single payment plans. You can see all orders from your site's Subscriptions page in the Dashboard.

wixPayOrderId
string

ID of the associated Wix Pay order.

Created by the createOnlineOrder() or createfflineOrder() function. For online orders, send this value as a parameter to the Wix Pay startPayment() function to enable your buyer to pay for the order. wixPayOrderId is omitted if the order is free.

buyer
Buyer

The buyer's IDs. Includes memberId and contactId.

Currently, Pricing Plan orders are limited to members only. contactId is returned, but a buyer will not be able to order a plan without a memberId.

priceDetails
PriceDetails

Deprecated. Use pricing instead.

pricing
Pricing

Order pricing model, price, and payment schedule.

type
string

How the order was processed. Supported values:

  • "ONLINE". The buyer ordered the plan using the site.
  • "OFFLINE". The buyer made a manual, offline order without using the site.
status
string

Status of the order. Supported values:

  • "DRAFT". The order has been initiated but payment hasn't been processed yet. The plan isn't yet available for use.
  • "PENDING". The order has been processed and its start date is set in the future. The plan isn't yet available for use.
  • "ACTIVE". The order has been processed. The plan is available for use.
  • "PAUSED". The order, and use of the plan, is paused. For example, if the buyer is away. The order, and use of the plan, can be resumed.
  • "ENDED". The order has completed its duration and is no longer available for use.
  • "CANCELED". The order has been canceled.
autoRenewCanceled
boolean

Whether the order will be canceled at the next payment date.

If true, the order status will be CANCELED and the next payment won't be charged. Omitted for single payment orders.

cancellation
Cancellation

Details about the cancellation of an order. Only present if the status is "CANCELED".

lastPaymentStatus
string

Status of the last payment for the order. This is updated automatically for online orders. The site owner updates this manually for offline orders. Supported values:

  • "PAID". The last payment was paid.
  • "REFUNDED". The last payment was refunded.
  • "FAILED". The last payment transaction didn't complete.
  • "UNPAID". The last payment wasn't paid.
  • "PENDING". Awaiting payment.
  • "NOT_APPLICABLE". No payment was necessary. For example, for free plans or free trials.
startDate
Date

Start date and time for the ordered plan.

endDate
Date

Current date and time the ordered plan will expire.

endDate may be updated over the course of an order. If the order is paused, it will have a later endDate once it resumes. endDate may also be postponed.

Omitted if the order is valid until canceled and still "ACTIVE".

pausePeriods
Array<PausePeriod>

List of periods during which this order is paused.

freeTrialDays
string

Free trial period, in days. Only available for recurring plans.

earliestEndDate
Date

Earliest end date and time that the plan for this order can expire.

This is calculated by adding all pause periods to the original end date. Omitted if the order is active until canceled. Reserved for future use.

currentCycle
CurrentCycle

Current payment cycle for the order.

currentCycle will be omitted if the order's status is CANCELED or ENDED, or if the startDate hasn't passed yet.

planName
string

Name of the plan at the time of the order.

planDescription
string

Description of the plan at the time of the order.

planPrice
string

Plan price as it was at the moment of order creation.

_createdDate
Date

Date and time the order was created.

_updatedDate
Date

Date and time the order was last updated. For example, the date and time an order was paused, resumed, or canceled.

Related Content:

Was this helpful?

List the current member's orders on button click

Copy Code
1import { orders } from 'wix-pricing-plans-frontend';
2
3$w('#myListOrdersButton').onClick((event) => {
4 orders.listCurrentMemberOrders()
5 .then((ordersList) => {
6 const firstOrder = ordersList[0];
7 const firstOrderStatus = ordersList[0].status;
8
9 console.log('Your orders:', ordersList);
10 return ordersList;
11 })
12 .catch((error) => {
13 console.error(error);
14 })
15});
16
17/* In this case, a `myOrderList` array of two order items:
18 * [
19 * {
20 * "_id": "d9667014-b773-40b1-871d-041cedd9302e",
21 * "planId": "60f0e90f-06f6-4b9c-8cd7-5a02d015d98b",
22 * "subscriptionId": "14e11d7d-46e2-46be-a8a0-5484f595701c",
23 * "buyer": {
24 * "memberId": "0c9bca47-1f00-4b92-af1c-7852452e949a",
25 * "contactId": "0c9bca47-1f00-4b92-af1c-7852452e949a"
26 * },
27 * "priceDetails": {
28 * "subtotal": "0",
29 * "discount": "0",
30 * "total": "0",
31 * "planPrice": "0",
32 * "currency": "EUR",
33 * "singlePaymentForDuration": {
34 * "count": 1,
35 * "unit": "MONTH"
36 * }
37 * },
38 * "pricing": {
39 * "singlePaymentForDuration": {
40 * "count": 1,
41 * "unit": "MONTH"
42 * },
43 * "prices": [
44 * {
45 * "duration": {
46 * "cycleFrom": 1,
47 * "numberOfCycles": 1
48 * },
49 * "price": {
50 * "subtotal": "0",
51 * "discount": "0",
52 * "total": "0",
53 * "currency": "EUR"
54 * }
55 * }
56 * ]
57 * },
58 * "type": "ONLINE",
59 * "orderMethod": "UNKNOWN",
60 * "status": "PENDING",
61 * "lastPaymentStatus": "NOT_APPLICABLE",
62 * "startDate": "2022-08-25T07:44:00.000Z",
63 * "endDate": "2022-09-25T07:44:00.000Z",
64 * "pausePeriods": [],
65 * "earliestEndDate": "2022-09-25T07:44:00.000Z",
66 * "planName": "Free Trial",
67 * "planDescription": "Come try it out!",
68 * "planPrice": "0",
69 * "_createdDate": "2022-08-23T23:57:36.745Z",
70 * "_updatedDate": "2022-08-23T23:57:37.126Z"
71 * },
72 * {
73 * "_id": "a8c4a1b2-b5e8-4b33-9693-057ec93e9a27",
74 * "planId": "099e2c86-3b7e-4477-8c27-f77402b8cceb",
75 * "subscriptionId": "f0cd38ff-a0a5-403c-9882-454e6badf64b",
76 * "wixPayOrderId": "ad363d3d-dc48-45cf-8454-62bee1e750e9",
77 * "buyer": {
78 * "memberId": "0c9bca47-1f00-4b92-af1c-7852452e949a",
79 * "contactId": "0c9bca47-1f00-4b92-af1c-7852452e949a"
80 * },
81 * "priceDetails": {
82 * "subtotal": "74.99",
83 * "discount": "0",
84 * "total": "74.99",
85 * "planPrice": "74.99",
86 * "currency": "EUR",
87 * "subscription": {
88 * "cycleDuration": {
89 * "count": 1,
90 * "unit": "MONTH"
91 * },
92 * "cycleCount": 3
93 * }
94 * },
95 * "pricing": {
96 * "subscription": {
97 * "cycleDuration": {
98 * "count": 1,
99 * "unit": "MONTH"
100 * },
101 * "cycleCount": 3
102 * },
103 * "prices": [
104 * {
105 * "duration": {
106 * "cycleFrom": 1,
107 * "numberOfCycles": 3
108 * },
109 * "price": {
110 * "subtotal": "74.99",
111 * "discount": "0",
112 * "total": "74.99",
113 * "currency": "EUR"
114 * }
115 * }
116 * ]
117 * },
118 * "type": "OFFLINE",
119 * "orderMethod": "UNKNOWN",
120 * "status": "CANCELED",
121 * "autoRenewCanceled": true,
122 * "cancellation": {
123 * "cause": "OWNER_ACTION",
124 * "effectiveAt": "IMMEDIATELY"
125 * },
126 * "lastPaymentStatus": "PAID",
127 * "startDate": "2022-07-22T17:50:26.000Z",
128 * "endDate": "2022-07-22T13:00:21.694Z",
129 * "pausePeriods": [],
130 * "earliestEndDate": "2022-10-22T17:50:26.000Z",
131 * "planName": "Platinum Pro",
132 * "planDescription": "",
133 * "planPrice": "74.99",
134 * "_createdDate": "2022-07-22T12:30:48.472Z",
135 * "_updatedDate": "2022-07-22T13:00:21.785Z"
136 * }
137 * ]
138 */
Filter, sort, and list the current member's orders for given plan and order statuses

Copy Code
1import { orders } from 'wix-pricing-plans-frontend';
2
3
4/* Sample filters object:
5 * {
6 * 'orderStatuses': ['PAUSED', 'CANCELED']
7 * }
8 */
9
10/* Sample sorting object:
11 * {
12 * 'fieldName': '_createdDate',
13 * 'order': 'DESC'
14 * }
15 */
16
17/* Sample paging object:
18 * {
19 * 'limit': 2
20 * }
21 */
22
23$w('#listMyOrdersButton').onClick((event) => {
24 orders.listCurrentMemberOrders(filters, sorting, paging)
25 .then((ordersList) => {
26 const firstOrderId = ordersList[0]._id;
27 const firstCreatedDate = ordersList[0]._createdDate;
28
29 console.log('Your list of filtered and sorted orders:', ordersList);
30 return ordersList;
31 })
32 .catch((error) => {
33 console.error(error);
34 })
35});
36
37/* Promise resolves to:
38 * [
39 * {
40 * "_id": "06d7ce1a-0a94-4395-841f-4af3f09913ab",
41 * "planId": "9f4ad2f3-d948-4daf-b517-eb2206b01ea1",
42 * "subscriptionId": "f6abaa62-dfbd-4ab4-b483-c42d4c91e753",
43 * "wixPayOrderId": "e4afdb18-1943-4769-8f82-26a0b07ed82d",
44 * "buyer": {
45 * "memberId": "0c9bca47-1f00-4b92-af1c-7852452e949a",
46 * "contactId": "0c9bca47-1f00-4b92-af1c-7852452e949a"
47 * },
48 * "priceDetails": {
49 * "subtotal": "10.00",
50 * "discount": "0",
51 * "total": "10.00",
52 * "planPrice": "10.00",
53 * "currency": "USD",
54 * "singlePaymentUnlimited": true
55 * },
56 * "pricing": {
57 * "singlePaymentUnlimited": true,
58 * "prices": [
59 * {
60 * "duration": {
61 * "cycleFrom": 1,
62 * "numberOfCycles": 1
63 * },
64 * "price": {
65 * "subtotal": "10.00",
66 * "discount": "0",
67 * "total": "10.00",
68 * "currency": "USD"
69 * }
70 * }
71 * ]
72 * },
73 * "type": "OFFLINE",
74 * "orderMethod": "UNKNOWN",
75 * "status": "CANCELED",
76 * "cancellation": {
77 * "cause": "MEMBER_ACTION",
78 * "effectiveAt": "IMMEDIATELY"
79 * },
80 * "lastPaymentStatus": "PAID",
81 * "startDate": "2022-04-17T14:51:19.506Z",
82 * "endDate": "2022-05-03T13:33:11.588Z",
83 * "pausePeriods": [],
84 * "planName": "Gold",
85 * "planDescription": "Gold membership to the MyGame World of Online Gaming",
86 * "planPrice": "10.00",
87 * "_createdDate": "2022-04-17T14:51:33.886Z",
88 * "_updatedDate": "2022-05-03T13:33:11.620Z"
89 * },
90 * {
91 * "_id": "01822c51-cde0-4cc0-a8ed-6beb7f9491dc",
92 * "planId": "6d7537c5-beac-44a3-bea3-b947ddc56b31",
93 * "subscriptionId": "ad747b09-d4c7-466f-8e3d-37a32076bfba",
94 * "wixPayOrderId": "cf140d00-2a49-41b3-954b-6f9f0712b799",
95 * "buyer": {
96 * "memberId": "0c9bca47-1f00-4b92-af1c-7852452e949a",
97 * "contactId": "0c9bca47-1f00-4b92-af1c-7852452e949a"
98 * },
99 * "priceDetails": {
100 * "subtotal": "14.99",
101 * "discount": "0",
102 * "total": "14.99",
103 * "planPrice": "14.99",
104 * "currency": "EUR",
105 * "subscription": {
106 * "cycleDuration": {
107 * "count": 1,
108 * "unit": "MONTH"
109 * },
110 * "cycleCount": 0
111 * }
112 * },
113 * "pricing": {
114 * "subscription": {
115 * "cycleDuration": {
116 * "count": 1,
117 * "unit": "MONTH"
118 * },
119 * "cycleCount": 0
120 * },
121 * "prices": [
122 * {
123 * "duration": {
124 * "cycleFrom": 1
125 * },
126 * "price": {
127 * "subtotal": "14.99",
128 * "discount": "0",
129 * "total": "14.99",
130 * "currency": "EUR"
131 * }
132 * }
133 * ]
134 * },
135 * "type": "OFFLINE",
136 * "orderMethod": "UNKNOWN",
137 * "status": "CANCELED",
138 * "autoRenewCanceled": true,
139 * "cancellation": {
140 * "cause": "OWNER_ACTION",
141 * "effectiveAt": "IMMEDIATELY"
142 * },
143 * "lastPaymentStatus": "PAID",
144 * "startDate": "2022-06-01T13:45:53.129Z",
145 * "endDate": "2022-05-25T21:52:37.108Z",
146 * "pausePeriods": [],
147 * "planName": "2x Week",
148 * "planDescription": "",
149 * "planPrice": "14.99",
150 * "_createdDate": "2022-05-25T21:40:36.700Z",
151 * "_updatedDate": "2022-05-25T21:52:37.205Z"
152 * }
153 * ]
154 */
List the current member's orders in a table

Copy Code
1import { orders } from 'wix-pricing-plans-frontend';
2
3// The "columns" constant is used to set
4// the properties of the table columns.
5const columns = [
6 {
7 id: 'orderID',
8 dataPath: '_id',
9 label: 'Order',
10 width: 15,
11 visible: true,
12 type: 'string'
13 },
14 {
15 id: 'planName',
16 dataPath: 'planName',
17 label: 'Plan',
18 width: 15,
19 visible: true,
20 type: 'string'
21 },
22 {
23 id: 'planID',
24 dataPath: 'planId',
25 label: 'Plan ID',
26 width: 15,
27 visible: true,
28 type: 'string'
29 },
30 {
31 id: 'subID',
32 dataPath: 'subscriptionId',
33 label: 'Subscription ID',
34 width: 15,
35 visible: true,
36 type: 'string'
37 },
38 {
39 id: 'wixPayID',
40 dataPath: 'wixPayOrderId',
41 label: 'Wix Pay ID',
42 width: 15,
43 visible: true,
44 type: 'string'
45 },
46 {
47 id: 'type',
48 dataPath: 'type',
49 label: 'Type',
50 width: 8,
51 visible: true,
52 type: 'string'
53 },
54 {
55 id: 'status',
56 dataPath: 'status',
57 label: 'Status',
58 width: 8,
59 visible: true,
60 type: 'string'
61 }
62];
63
64$w('#listMyOrdersButton').onClick((event) => {
65 $w('#myOrdersTable').rows = [];
66 $w('#myOrdersTable').columns = columns;
67
68 orders.listCurrentMemberOrders()
69 .then((myOrdersList) => {
70 $w('#myOrdersTable').rows = myOrdersList;
71 })
72 .catch((error) => {
73 console.error(error);
74 });
75});