Search...
managementGetOrder( )
Developer Preview
Retrieves an order by ID.
Description
The managementGetOrder()
function returns a Promise that resolves to information about the specified order.
Admin Method
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function managementGetOrder(_id: string, options: ManagementGetOrderOptions): Promise<GetOrderResponse>
managementGetOrder Parameters
NAME
TYPE
DESCRIPTION
_id
string
Order ID.
options
Optional
ManagementGetOrderOptions
Options to use when getting an order.
Returns
Return Type:
Promise<
GetOrderResponse
>NAME
TYPE
DESCRIPTION
order
Order
Order.
Was this helpful?
Get an order (dashboard page code)
Copy Code
1import { orders } from 'wix-pricing-plans.v2';2import { elevate } from 'wix-auth';34/* Sample _id value:'12178428-36b7-4cf5-bfb5-0ba8c83c4e8c' */56const elevatedManagementGetOrder = elevate(orders.managementGetOrder);78export async function myManagementGetOrderFunction(_id) {9 try {10 const order = await elevatedManagementGetOrder(_id);1112 return order;13 } catch (error) {14 console.error(error);15 // Handle the error16 }17}1819/* Promise resolves to:20 * {21 * order: {22 * "_createdDate": "2024-01-31T10:59:16.422Z",23 * "_id": "12178428-36b7-4cf5-bfb5-0ba8c83c4e8c",24 * "_updatedDate": "2024-01-31T10:59:17.495Z",25 * "buyer": {26 * "contactId": "3fc889f6-18e8-4fd9-a509-27db9f037f26",27 * "memberId": "3fc889f6-18e8-4fd9-a509-27db9f037f26"28 * },29 * "currentCycle": {30 * "index": 1,31 * "startedDate": "2024-01-31T10:59:16.422Z"32 * },33 * "cycles": [34 * {35 * "index": 1,36 * "startedDate": "2024-01-31T10:59:16.422Z"37 * }38 * ],39 * "formData": {40 * "formId": "3ef36359-24bd-471a-aa8b-a5ca683b50f4",41 * "submissionData": {},42 * "submissionId": "e65d5d60-7e07-4d2f-971f-e471dcebd0d2"43 * },44 * "lastPaymentStatus": "NOT_APPLICABLE",45 * "orderMethod": "UNKNOWN",46 * "planDescription": "Full functionality for new users",47 * "planId": "df83348a-777d-46ab-8d62-a43c415bdb11",48 * "planName": "Standard Plan",49 * "planPrice": "0",50 * "priceDetails": {51 * "currency": "USD",52 * "discount": "0",53 * "planPrice": "0",54 * "singlePaymentUnlimited": true,55 * "subtotal": "0.00",56 * "total": "0"57 * },58 * "pricing": {59 * "prices": [60 * {61 * "duration": {62 * "cycleFrom": 1,63 * "numberOfCycles": 164 * },65 * "price": {66 * "currency": "USD",67 * "discount": "0",68 * "fees": [],69 * "proration": "0",70 * "subtotal": "0.00",71 * "total": "0"72 * }73 * }74 * ],75 * "singlePaymentUnlimited": true76 * },77 * "startDate": "2024-01-31T10:59:16.422Z",78 * "status": "ACTIVE",79 * "statusNew": "ACTIVE",80 * "subscriptionId": "b1e7d751-7727-4c07-a0b5-0ab017ef7d1b",81 * "type": "ONLINE"82 * }83 * }84 */
Get an order (export from backend code)
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { orders } from 'wix-pricing-plans.v2';3import { elevate } from 'wix-auth';45// Sample _id value:'12178428-36b7-4cf5-bfb5-0ba8c83c4e8c'67const elevatedManagementGetOrder = elevate(orders.managementGetOrder);89export const myManagementGetOrderFunction = webMethod(Permissions.Anyone, async (_id) => {10 try {11 const order = await elevatedManagementGetOrder(_id);1213 return order;14 } catch (error) {15 console.error(error);16 // Handle the error17 }18});1920/* Promise resolves to:21 * {22 * order: {23 * "_createdDate": "2024-01-31T10:59:16.422Z",24 * "_id": "12178428-36b7-4cf5-bfb5-0ba8c83c4e8c",25 * "_updatedDate": "2024-01-31T10:59:17.495Z",26 * "buyer": {27 * "contactId": "3fc889f6-18e8-4fd9-a509-27db9f037f26",28 * "memberId": "3fc889f6-18e8-4fd9-a509-27db9f037f26"29 * },30 * "currentCycle": {31 * "index": 1,32 * "startedDate": "2024-01-31T10:59:16.422Z"33 * },34 * "cycles": [35 * {36 * "index": 1,37 * "startedDate": "2024-01-31T10:59:16.422Z"38 * }39 * ],40 * "formData": {41 * "formId": "3ef36359-24bd-471a-aa8b-a5ca683b50f4",42 * "submissionData": {},43 * "submissionId": "e65d5d60-7e07-4d2f-971f-e471dcebd0d2"44 * },45 * "lastPaymentStatus": "NOT_APPLICABLE",46 * "orderMethod": "UNKNOWN",47 * "planDescription": "Full functionality for new users",48 * "planId": "df83348a-777d-46ab-8d62-a43c415bdb11",49 * "planName": "Standard Plan",50 * "planPrice": "0",51 * "priceDetails": {52 * "currency": "USD",53 * "discount": "0",54 * "planPrice": "0",55 * "singlePaymentUnlimited": true,56 * "subtotal": "0.00",57 * "total": "0"58 * },59 * "pricing": {60 * "prices": [61 * {62 * "duration": {63 * "cycleFrom": 1,64 * "numberOfCycles": 165 * },66 * "price": {67 * "currency": "USD",68 * "discount": "0",69 * "fees": [],70 * "proration": "0",71 * "subtotal": "0.00",72 * "total": "0"73 * }74 * }75 * ],76 * "singlePaymentUnlimited": true77 * },78 * "startDate": "2024-01-31T10:59:16.422Z",79 * "status": "ACTIVE",80 * "statusNew": "ACTIVE",81 * "subscriptionId": "b1e7d751-7727-4c07-a0b5-0ab017ef7d1b",82 * "type": "ONLINE"83 * }84 * }85 */86
Get an order with options
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { orders } from 'wix-pricing-plans.v2';3import { elevate } from 'wix-auth';45/* Sample _id value:'12178428-36b7-4cf5-bfb5-0ba8c83c4e8c'6 *7 * Sample options value:8 * {9 * fieldSet: 'FULL'10 * }11 *12 */1314const elevatedManagementGetOrder = elevate(orders.managementGetOrder);1516export const myManagementGetOrderFunction = webMethod(Permissions.Anyone, async (_id) => {17 try {18 const order = await elevatedManagementGetOrder(_id);1920 return order;21 } catch (error) {22 console.error(error);23 // Handle the error24 }25});2627/* Promise resolves to:28 * {29 * "_createdDate": "2024-01-31T10:59:16.422Z",30 * "_id": "12178428-36b7-4cf5-bfb5-0ba8c83c4e8c",31 * "_updatedDate": "2024-01-31T10:59:17.495Z",32 * "buyer": {33 * "contactId": "3fc889f6-18e8-4fd9-a509-27db9f037f26",34 * "memberId": "3fc889f6-18e8-4fd9-a509-27db9f037f26"35 * },36 * "currentCycle": {37 * "index": 1,38 * "startedDate": "2024-01-31T10:59:16.422Z"39 * },40 * "cycles": [41 * {42 * "index": 1,43 * "startedDate": "2024-01-31T10:59:16.422Z"44 * }45 * ],46 * "formData": {47 * "formId": "3ef36359-24bd-471a-aa8b-a5ca683b50f4",48 * "submissionData": {49 * "email_7b7a": "Sgray@email.com",50 * "first_name_e841": "Stanley",51 * "form_field_1b5e": true,52 * "last_name_3347": "Grayson"53 * },54 * "submissionId": "e65d5d60-7e07-4d2f-971f-e471dcebd0d2"55 * },56 * "lastPaymentStatus": "NOT_APPLICABLE",57 * "order": {58 * "currentCycle": {59 * "index": 1,60 * "startedDate": "2024-01-31T10:59:16.422Z"61 * },62 * "cycles": [63 * {64 * "index": 1,65 * "startedDate": "2024-01-31T10:59:16.422Z"66 * }67 * ],68 * "formData": {69 * "formId": "3ef36359-24bd-471a-aa8b-a5ca683b50f4",70 * "submissionData": {71 * "email_7b7a": "Sgray@email.com",72 * "first_name_e841": "Stanley",73 * "form_field_1b5e": true,74 * "last_name_3347": "Grayson"75 * },76 * "submissionId": "e65d5d60-7e07-4d2f-971f-e471dcebd0d2"77 * },78 * "lastPaymentStatus": "NOT_APPLICABLE",79 * "orderMethod": "UNKNOWN",80 * "planDescription": "Full functionality for new users",81 * "planId": "df83348a-777d-46ab-8d62-a43c415bdb11",82 * "planName": "Standard Plan",83 * "planPrice": "0",84 * "priceDetails": {85 * "currency": "USD",86 * "discount": "0",87 * "planPrice": "0",88 * "singlePaymentUnlimited": true,89 * "subtotal": "0.00",90 * "total": "0"91 * },92 * "pricing": {93 * "prices": [94 * {95 * "duration": {96 * "cycleFrom": 1,97 * "numberOfCycles": 198 * },99 * "price": {100 * "currency": "USD",101 * "discount": "0",102 * "fees": [],103 * "proration": "0",104 * "subtotal": "0.00",105 * "total": "0"106 * }107 * }108 * ],109 * "singlePaymentUnlimited": true110 * },111 * "startDate": "2024-01-31T10:59:16.422Z",112 * "status": "ACTIVE",113 * "statusNew": "ACTIVE",114 * "subscriptionId": "b1e7d751-7727-4c07-a0b5-0ab017ef7d1b",115 * "type": "ONLINE"116 * },117 * "pausePeriods": [],118 * "planDescription": "Full functionality for new users",119 * "planId": "df83348a-777d-46ab-8d62-a43c415bdb11",120 * "planName": "Standard Plan",121 * "planPrice": "0",122 * "priceDetails": {123 * "currency": "USD",124 * "discount": "0",125 * "planPrice": "0",126 * "singlePaymentUnlimited": true,127 * "subtotal": "0.00",128 * "total": "0"129 * },130 * "pricing": {131 * "prices": [132 * {133 * "duration": {134 * "cycleFrom": 1,135 * "numberOfCycles": 1136 * },137 * "price": {138 * "currency": "USD",139 * "discount": "0",140 * "fees": [],141 * "proration": "0",142 * "subtotal": "0.00",143 * "total": "0"144 * }145 * }146 * ],147 * "singlePaymentUnlimited": true148 * },149 * "startDate": "2024-01-31T10:59:16.422Z",150 * "status": "ACTIVE",151 * "statusNew": "ACTIVE",152 * "subscriptionId": "b1e7d751-7727-4c07-a0b5-0ab017ef7d1b",153 * "type": "ONLINE"154 * }155 */156