Retrieves an order by ID.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function managementGetOrder(
_id: string,
options: ManagementGetOrderOptions,
): Promise<GetOrderResponse>;
Order ID.
Options to use when getting an order.
import { orders } from "wix-pricing-plans.v2";
import { elevate } from "wix-auth";
/* Sample _id value:'12178428-36b7-4cf5-bfb5-0ba8c83c4e8c' */
const elevatedManagementGetOrder = elevate(orders.managementGetOrder);
export async function myManagementGetOrderFunction(_id) {
try {
const order = await elevatedManagementGetOrder(_id);
return order;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* order: {
* "_createdDate": "2024-01-31T10:59:16.422Z",
* "_id": "12178428-36b7-4cf5-bfb5-0ba8c83c4e8c",
* "_updatedDate": "2024-01-31T10:59:17.495Z",
* "buyer": {
* "contactId": "3fc889f6-18e8-4fd9-a509-27db9f037f26",
* "memberId": "3fc889f6-18e8-4fd9-a509-27db9f037f26"
* },
* "currentCycle": {
* "index": 1,
* "startedDate": "2024-01-31T10:59:16.422Z"
* },
* "cycles": [
* {
* "index": 1,
* "startedDate": "2024-01-31T10:59:16.422Z"
* }
* ],
* "formData": {
* "formId": "3ef36359-24bd-471a-aa8b-a5ca683b50f4",
* "submissionData": {},
* "submissionId": "e65d5d60-7e07-4d2f-971f-e471dcebd0d2"
* },
* "lastPaymentStatus": "NOT_APPLICABLE",
* "orderMethod": "UNKNOWN",
* "planDescription": "Full functionality for new users",
* "planId": "df83348a-777d-46ab-8d62-a43c415bdb11",
* "planName": "Standard Plan",
* "planPrice": "0",
* "priceDetails": {
* "currency": "USD",
* "discount": "0",
* "planPrice": "0",
* "singlePaymentUnlimited": true,
* "subtotal": "0.00",
* "total": "0"
* },
* "pricing": {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 1
* },
* "price": {
* "currency": "USD",
* "discount": "0",
* "fees": [],
* "proration": "0",
* "subtotal": "0.00",
* "total": "0"
* }
* }
* ],
* "singlePaymentUnlimited": true
* },
* "startDate": "2024-01-31T10:59:16.422Z",
* "status": "ACTIVE",
* "statusNew": "ACTIVE",
* "subscriptionId": "b1e7d751-7727-4c07-a0b5-0ab017ef7d1b",
* "type": "ONLINE"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.