getCurrentMemberOrders( )
Gets the orders (plan subscriptions) for the currently-logged in member.
Description
The getCurrentMemberOrders()
function returns a Promise that resolves to an array of the orders (plan subscriptions) for the currently-logged in member.
Note:
To work with the Paid Plans API, you need to publish your site.
Syntax
function getCurrentMemberOrders([offset: number], [limit: number]): Promise<Array<Order>>
getCurrentMemberOrders Parameters
NAME
TYPE
DESCRIPTION
number
The number of orders to skip before retrieving orders. If not set, offset
is 0
.
number
The maximum number of orders the function returns. If not set, limit
is 50
, which is the maximum.
Returns
Fulfilled - An array of order objects for the currently-logged in member. Rejected - Error message.
Return Type:
NAME
TYPE
DESCRIPTION
string
Order ID of the purchase of the plan, auto-generated when an order is created.
string
Status of the payment for the plan. Can be PAID
, FAILED
, UNPAID
, and PAYMENT_STATUS_UNDEFINED
.
Date
Date and time until which the plan is valid.
Price
Object containing the price of the plan.
Date
Date and time from which the plan is valid.
string
Name of the plan.
string
ID of the plan for Wix Pay. If plan is free, this ID is blank.
boolean
If the plan is recurring. If true, the price is deducted weekly, monthly, or yearly.
Date
Date and time the order was created.
string
Status of the order. Can be ACTIVE
, PENDING
, CANCELED
, EXPIRED
, PENDING_CANCELLATION
, and ORDER_STATUS_UNDEFINED
.
string
Role assigned after purchasing the plan.
string
Description of the plan.
string
ID for the visitor who purchased the plan.
string
How the plan was purchased, either ONLINE
or OFFLINE
.
string
ID of the plan.
ValidFor
Object containing properties about how long the plan is valid.
number
How many trial days were given to the subscriber of the plan.
string
If the plan is cancelled, the cause of the cancellation. One of:
"UNDEFINED"
: Cancellation initiator unknown."OWNER"
: Order (subscription) was canceled by site owner."MEMBER"
: Order (subscription) was canceled by member."PAYMENT_FAILURE"
: Subscription was canceled because of payment failure."SETUP_FAILURE"
: Subscription was canceled because of payment setup failure.
Was this helpful?
Get the current member's orders (subscriptions) on button click
Code Example
1import wixPaidPlans from 'wix-paid-plans';2import wixWindow from 'wix-window';34// Call getCurrentMemberOrders() when user clicks button5export function getOrdersButton_click(event) {67 wixPaidPlans.getCurrentMemberOrders()89 // Display orders in a table10 .then ( orders => {11 $w("#orderTable").rows = orders;12 } )13 .catch( (err) => {14 console.log(err);15 } );16 }171819/* In this case, an orders array of two order items:20 * [21 * {22 * "id":"d3e95-...-6ec0",23 * "planId":"8050a0-...-ac9ab3",24 * "memberId":"4333a-...-0374ba",25 * "roleId":"8050a-...-c9ab3",26 * "orderType":"ONLINE",27 * "status":"ACTIVE",28 * "wixPayOrderId":"88265-...-e159",29 * "paymentStatus":"PAID",30 * "price":{31 * "amount":32,32 * "currency":"USD"33 * },34 * "planName":"Premium",35 * "planDescription":"Our most exclusive plan.",36 * "recurring":true,37 * "validFor": {38 * "forever":false,39 * "period": {40 * "amount":6,41 * "unit":"MONTH"42 * }43 * },44 * "validFrom":"2020-02-17T12:00:58.735Z",45 * "validUntil":"2020-08-17T12:00:58.735Z",46 * "dateCreated":"2020-02-17T12:00:58.735Z",47 * "cancellationInitiator":"UNDEFINED"48 * },49 * {50 * "id":"7861d30c--...-ad05de8",51 * "planId":"8050a0-...-ac9ab3",52 * "memberId":"4333a-...-0374ba",53 * "roleId":"8050a-...-47ac9ab3",54 * "orderType":"ONLINE",55 * "status":"ACTIVE",56 * "wixPayOrderId":"9215ac1-...-733c4668",57 * "paymentStatus":"PAID",58 * "price":{59 * "amount":32,60 * "currency":"USD"61 * },62 * "planName":"Basic",63 * "planDescription":"Our most basic plan",64 * "recurring":true,65 * "validFor": {66 * "forever":false,67 * "period": {68 * "amount":6,69 * "unit":"MONTH"70 * }71 * },72 * "validFrom":"2020-02-17T12:00:36.875Z",73 * "validUntil":"2020-08-17T12:00:36.875Z",74 * "dateCreated":"2020-02-17T12:00:36.875Z",75 * "cancellationInitiator":"UNDEFINED"76 * }77 * ]78 */