Search.../

memberGetOrder( )

Gets an order by ID for the currently logged-in member.

Description

The memberGetOrder() function returns a Promise that resolves to information about a specified order for the currently logged-in member.

Syntax

function memberGetOrder(_id: string, options: MemberGetOrderOptions): Promise<Order>

memberGetOrder Parameters

NAME
TYPE
DESCRIPTION
_id
string

Order ID.

options
Optional
MemberGetOrderOptions

Options for getting a logged-in member's order.

Returns

Requested order.

Return Type:

Promise<
Order
>
NAME
TYPE
DESCRIPTION
_createdDate
Date

Date and time the order was created.

_id
string

Order ID.

_updatedDate
Date

Date and time the order was updated.

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.

buyer
Buyer

The buyer's IDs. Includes memberId and contactId.

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

cancellation
Cancellation

Details about the cancellation of an order.

Only present if the status is CANCELED.

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.

earliestEndDate
Date

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

Calculated by using the original end date plus any pause periods. Omitted if the order is active until canceled. Reserved for future use.

endDate
Date

Current end date and time for the ordered plan.

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.

formData
FormData

Information about the form submitted during the plan's checkout.

freeTrialDays
number

Free trial period for the order, in days.

Only available for recurring plans.

lastPaymentStatus
string

Status of the last payment for the order. Updated automatically for online orders. Updated manually by the site owner 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.
pausePeriods
Array<
PausePeriod
>

List of periods during which the order is paused.

planDescription
string

Plan description at the time of purchase

planId
string

ID of the plan purchased with the order.

planName
string

Plan name at the time of purchase.

planPrice
string

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

pricing
PricingDetails

Pricing model, price, and payment schedule for the order.

startDate
Date

Start date and time for the ordered plan.

status
string

Status of the order. Supported values:

  • DRAFT: Order has been initiated but payment hasn't been processed yet. The plan isn't yet available for use to the buyer.
  • PENDING: Order has been purchased and its start date is set in the future.
  • ACTIVE: Order has been processed. The plan is available for use.
  • PAUSED: Order, and use of the plan, is paused. The order, and use of the plan, can be resumed.
  • ENDED: Order has completed its duration and is no longer available for use.
  • CANCELED: Order has been canceled.
subscriptionId
string

ID of the related Wix subscription.

Every pricing plan order corresponds to a Wix subscription, including orders for single payment plans. See a Pricing Plans overview.

type
string

How the order was processed. Supported values:

  • "ONLINE": The buyer purchased the plan using the site.
  • "OFFLINE": The buyer made a manual, offline purchase without using the site.
wixPayOrderId
string

Wix Pay order ID.

Provided by Wix whether the order is created online or offline. The field is omitted when the order is free.

Was this helpful?

Get an order for logged-in member (export from backend code)

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { orders } from 'wix-pricing-plans.v2';
3
4// Sample _id: '7b4ec42c-582a-4e2f-874b-09e66e0ae09d'
5
6export const memberGetOrder = webMethod(Permissions.Anyone, async (_id) => {
7 try {
8 const order = await orders.memberGetOrder(_id);
9
10 return order;
11 } catch (error) {
12 console.error(error);
13 // Handle the error
14 }
15});
16
17/* Promise resolves to:
18 * {
19 * "_createdDate": "2024-01-28T08:35:15.230Z",
20 * "_id": "7b4ec42c-582a-4e2f-874b-09e66e0ae09d",
21 * "_updatedDate": "2024-01-28T08:35:16.080Z",
22 * "buyer": {
23 * "contactId": "695568ff-1dc2-49ff-83db-2b518d35692b",
24 * "memberId": "695568ff-1dc2-49ff-83db-2b518d35692b"
25 * },
26 * "currentCycle": {
27 * "index": 1,
28 * "startedDate": "2024-01-28T08:35:15.230Z"
29 * },
30 * "cycles": [
31 * {
32 * "index": 1,
33 * "startedDate": "2024-01-28T08:35:15.230Z"
34 * }
35 * ],
36 * "formData": {
37 * "formId": "3ef36359-24bd-471a-aa8b-a5ca683b50f4",
38 * "submissionData": {},
39 * "submissionId": "2cf62c7a-d3ed-4dd9-816d-01919aaf2170"
40 * },
41 * "lastPaymentStatus": "NOT_APPLICABLE",
42 * "orderMethod": "UNKNOWN",
43 * "pausePeriods": [],
44 * "planDescription": "Full functionality for new users",
45 * "planId": "df83348a-777d-46ab-8d62-a43c415bdb11",
46 * "planName": "Standard Plan",
47 * "planPrice": "0",
48 * "priceDetails": {
49 * "currency": "USD",
50 * "discount": "0",
51 * "planPrice": "0",
52 * "singlePaymentUnlimited": true,
53 * "subtotal": "0.00",
54 * "total": "0"
55 * },
56 * "pricing": {
57 * "prices": [
58 * {
59 * "duration": {
60 * "cycleFrom": 1,
61 * "numberOfCycles": 1
62 * },
63 * "price": {
64 * "currency": "USD",
65 * "discount": "0",
66 * "fees": [],
67 * "proration": "0",
68 * "subtotal": "0.00",
69 * "total": "0"
70 * }
71 * }
72 * ],
73 * "singlePaymentUnlimited": true
74 * },
75 * "startDate": "2024-01-28T08:35:15.230Z",
76 * "status": "ACTIVE",
77 * "statusNew": "ACTIVE",
78 * "subscriptionId": "08bc02c5-7663-4578-948a-ff23370e07e5",
79 * "type": "ONLINE"
80 * }
81 */
82
Get an order for a logged-in member with options

Copy Code
1import { orders } from 'wix-pricing-plans.v2';
2
3/* Sample _id: 'b14e3821-868f-4aa6-b874-e9240100985c'
4 *
5 * Sample options value:
6 * {
7 * fieldSet: 'FULL'
8 * }
9 */
10
11export async function memberGetOrder(_id, options) {
12 try {
13 const order = await orders.memberGetOrder(_id, options);
14
15 return order;
16 } catch (error) {
17 console.error(error);
18 // Handle the error
19 }
20}
21
22/* Promise resolves to:
23 * {
24 * "_createdDate": "2024-01-31T10:20:31.602Z",
25 * "_id": "b14e3821-868f-4aa6-b874-e9240100985c",
26 * "_updatedDate": "2024-01-31T10:20:32.819Z",
27 * "buyer": {
28 * "contactId": "fa16f1dc-0fbd-41c0-8efc-53333e3fce1e",
29 * "memberId": "fa16f1dc-0fbd-41c0-8efc-53333e3fce1e"
30 * },
31 * "currentCycle": {
32 * "index": 1,
33 * "startedDate": "2024-01-31T10:20:31.602Z"
34 * },
35 * "cycles": [
36 * {
37 * "index": 1,
38 * "startedDate": "2024-01-31T10:20:31.602Z"
39 * }
40 * ],
41 * "formData": {
42 * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb",
43 * "submissionData": {
44 * "email_0fd2": "JV@email.com",
45 * "first_name_c551": "Jonathan",
46 * "form_field_aa30": false,
47 * "last_name_78e9": "Vernes",
48 * "phone_8cf1": "918-455-2587"
49 * },
50 * "submissionId": "9e128ddb-f62f-4a4a-adb5-064af40f18db"
51 * },
52 * "lastPaymentStatus": "NOT_APPLICABLE",
53 * "orderMethod": "UNKNOWN",
54 * "pausePeriods": [],
55 * "planDescription": "",
56 * "planId": "3a3e0ac2-a9e3-4bfd-ade3-bec3bab34d4b",
57 * "planName": "Free Plan",
58 * "planPrice": "0",
59 * "priceDetails": {
60 * "currency": "USD",
61 * "discount": "0",
62 * "planPrice": "0",
63 * "singlePaymentUnlimited": true,
64 * "subtotal": "0.00",
65 * "total": "0"
66 * },
67 * "pricing": {
68 * "prices": [
69 * {
70 * "duration": {
71 * "cycleFrom": 1,
72 * "numberOfCycles": 1
73 * },
74 * "price": {
75 * "currency": "USD",
76 * "discount": "0",
77 * "fees": [],
78 * "proration": "0",
79 * "subtotal": "0.00",
80 * "total": "0"
81 * }
82 * }
83 * ],
84 * "singlePaymentUnlimited": true
85 * },
86 * "startDate": "2024-01-31T10:20:31.602Z",
87 * "status": "ACTIVE",
88 * "statusNew": "ACTIVE",
89 * "subscriptionId": "1c36ad20-fbc1-4857-8fda-efb8d2cd1a5c",
90 * "type": "ONLINE"
91 * }
92 */
93
94
95
96
Get an order for a logged-in member with options

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { orders } from 'wix-pricing-plans.v2';
3
4/*
5 * Sample _id: 'b14e3821-868f-4aa6-b874-e9240100985c'
6 *
7 * Sample options value:
8 * {
9 * fieldSet: 'FULL'
10 * }
11 */
12
13export const memberGetOrder = webMethod(Permissions.Anyone, async (_id, options) => {
14 try {
15 const order = await orders.memberGetOrder(_id, options);
16
17 return order;
18 } catch (error) {
19 console.error(error);
20 // Handle the error
21 }
22});
23
24/* Promise resolves to:
25 * {
26 * "_createdDate": "2024-01-31T10:20:31.602Z",
27 * "_id": "b14e3821-868f-4aa6-b874-e9240100985c",
28 * "_updatedDate": "2024-01-31T10:20:32.819Z",
29 * "buyer": {
30 * "contactId": "fa16f1dc-0fbd-41c0-8efc-53333e3fce1e",
31 * "memberId": "fa16f1dc-0fbd-41c0-8efc-53333e3fce1e"
32 * },
33 * "currentCycle": {
34 * "index": 1,
35 * "startedDate": "2024-01-31T10:20:31.602Z"
36 * },
37 * "cycles": [
38 * {
39 * "index": 1,
40 * "startedDate": "2024-01-31T10:20:31.602Z"
41 * }
42 * ],
43 * "formData": {
44 * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb",
45 * "submissionData": {
46 * "email_0fd2": "JV@email.com",
47 * "first_name_c551": "Jonathan",
48 * "form_field_aa30": false,
49 * "last_name_78e9": "Vernes",
50 * "phone_8cf1": "918-455-2587"
51 * },
52 * "submissionId": "9e128ddb-f62f-4a4a-adb5-064af40f18db"
53 * },
54 * "lastPaymentStatus": "NOT_APPLICABLE",
55 * "orderMethod": "UNKNOWN",
56 * "pausePeriods": [],
57 * "planDescription": "",
58 * "planId": "3a3e0ac2-a9e3-4bfd-ade3-bec3bab34d4b",
59 * "planName": "Free Plan",
60 * "planPrice": "0",
61 * "priceDetails": {
62 * "currency": "USD",
63 * "discount": "0",
64 * "planPrice": "0",
65 * "singlePaymentUnlimited": true,
66 * "subtotal": "0.00",
67 * "total": "0"
68 * },
69 * "pricing": {
70 * "prices": [
71 * {
72 * "duration": {
73 * "cycleFrom": 1,
74 * "numberOfCycles": 1
75 * },
76 * "price": {
77 * "currency": "USD",
78 * "discount": "0",
79 * "fees": [],
80 * "proration": "0",
81 * "subtotal": "0.00",
82 * "total": "0"
83 * }
84 * }
85 * ],
86 * "singlePaymentUnlimited": true
87 * },
88 * "startDate": "2024-01-31T10:20:31.602Z",
89 * "status": "ACTIVE",
90 * "statusNew": "ACTIVE",
91 * "subscriptionId": "1c36ad20-fbc1-4857-8fda-efb8d2cd1a5c",
92 * "type": "ONLINE"
93 * }
94 */
95