Search.../

listCurrentMemberOrders( )

Lists orders for the currently logged-in member.

Description

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.

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 - Pricing plan orders for the current member that match the specified filtering, sorting, and pagination options.

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.

Was this helpful?

List orders for the currently logged-in member

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { orders } from 'wix-pricing-plans-backend';
3
4/* Sample filters object:
5 * {
6 * orderStatuses: ['PAUSED', 'CANCELED']
7 * }
8 */
9
10/* Sample sorting object:
11 * {
12 * fieldName: ['createdDate'],
13 * order: ['ASC']
14 * }
15 */
16
17/* Sample paging object:
18 * {
19 * limit: 3,
20 * skip: 1
21 * }
22 */
23
24export const myListCurrentMemberOrdersFunction = webMethod(Permissions.Anyone, async (filters, sorting, paging) => {
25 try {
26 const listedOrders = await orders.listCurrentMemberOrders(filters, sorting, paging);
27 const firstOrderId = listedOrders.orders[0]._id;
28 const firstOrderStatus = listedOrders.orders[0].status;
29
30 return listedOrders;
31 } catch (error) {
32 console.error(error);
33 }
34});