> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: getOrder(orderId: string, options: Options)

# Method package: wixPricingPlansBackend

# Method menu location: wixPricingPlansBackend --> Orders --> getOrder

# Method Link: https://dev.wix.com/docs/velo/apis/wix-pricing-plans-backend/orders/get-order.md

# Method Description:

Gets an existing pricing plan order by ID.

The `getOrder()` function returns a Promise that resolves to information about the specified order.

 > **Note**: Only site visitors with the **Manage Pricing Plans** and **Manage Subscriptions** [permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Froles-and-permissions/roles)
 > can get orders. You can override the permissions by setting the function's `suppressAuth`
 > option to `true`.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Get an order by ID

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import { orders } from 'wix-pricing-plans-backend';

// Sample orderId: '02b7de48-b433-4d4b-b847-08c41c2b2b78'

export const myGetOrderFunction = webMethod(Permissions.Anyone, async (orderId) => {
  try {
    const order = await orders.getOrder(orderId);
    const id = order._id;
    const status = order.status;

    return order;
  } catch (error) {
    console.error(error);
  }
});

/* Promise resolves to:  
 * {
 *   "_id": "02b7de48-b433-4d4b-b847-08c41c2b2b78",
 *   "planId": "7251b9e9-3852-4e9f-958e-af630f039802",
 *   "subscriptionId": "45f4ab2c-bc09-4736-be68-674cc2169ad1",
 *   "buyer": {
 *     "memberId": "4c47c608-cfa8-4037-93ac-738f09560ed3",
 *     "contactId": "4c47c608-cfa8-4037-93ac-738f09560ed3"
 *   },
 *   "priceDetails": {
 *     "subtotal": "0",
 *     "discount": "0",
 *     "total": "0",
 *     "planPrice": "0",
 *     "currency": "USD",
 *     "singlePaymentUnlimited": true
 *   },
 *   "pricing": {
 *     "singlePaymentUnlimited": true,
 *     "prices": [
 *       {
 *         "duration": {
 *           "cycleFrom": 1
 *         },
 *         "price": {
 *           "subtotal": "0",
 *           "discount": "0",
 *           "total": "0",
 *           "currency": "USD"
 *         }
 *       }
 *     ]
 *   },
 *   "type": "ONLINE",
 *   "orderMethod": "UNKNOWN",
 *   "status": "ACTIVE",
 *   "lastPaymentStatus": "NOT_APPLICABLE",
 *   "startDate": "2021-10-31T11:00:00.000Z",
 *   "pausePeriods": [],
 *   "currentCycle": {
 *     "index": 1,
 *     "startedDate": "2021-10-31T11:00:00.000Z"
 *   },
 *   "planName": "Family Cooking",
 *   "planDescription": "Weekly delivery of home cooking recipes and time-saving tips",
 *   "planPrice": "0",
 *   "_createdDate": "2021-09-02T06:13:28.595Z",
 *   "_updatedDate": "2021-09-02T06:13:28.738Z"
 * }
 */
```

## Bypass permission checks to get an order

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import { orders } from 'wix-pricing-plans-backend';

/* Sample orderId: '02b7de48-b433-4d4b-b847-08c41c2b2b78'

 * Sample options object: 
 * { 
 *   "suppressAuth" : true 
 * }
 */

export const myGetOrderWithOptionsFunction = webMethod(Permissions.Anyone, async (orderId, options) => {
  try {
    const order = await orders.getOrder(orderId, options);
    const id = order._id;
    const status = order.status;

    return order;
  } catch (error) {
    console.error(error);
  }
});

/* Promise resolves to: 
 * {
 *   "_id": "02b7de48-b433-4d4b-b847-08c41c2b2b78",
 *   "planId": "7251b9e9-3852-4e9f-958e-af630f039802",
 *   "subscriptionId": "45f4ab2c-bc09-4736-be68-674cc2169ad1",
 *   "buyer": {
 *     "memberId": "4c47c608-cfa8-4037-93ac-738f09560ed3",
 *     "contactId": "4c47c608-cfa8-4037-93ac-738f09560ed3"
 *   },
 *   "priceDetails": {
 *     "subtotal": "0",
 *     "discount": "0",
 *     "total": "0",
 *     "planPrice": "0",
 *     "currency": "USD",
 *     "singlePaymentUnlimited": true
 *   },
 *   "pricing": {
 *     "singlePaymentUnlimited": true,
 *     "prices": [
 *       {
 *         "duration": {
 *           "cycleFrom": 1
 *         },
 *         "price": {
 *           "subtotal": "0",
 *           "discount": "0",
 *           "total": "0",
 *           "currency": "USD"
 *         }
 *       }
 *     ]
 *   },
 *   "type": "ONLINE",
 *   "orderMethod": "UNKNOWN",
 *   "status": "ACTIVE",
 *   "lastPaymentStatus": "NOT_APPLICABLE",
 *   "startDate": "2021-10-31T11:00:00.000Z",
 *   "pausePeriods": [],
 *   "currentCycle": {
 *     "index": 1,
 *     "startedDate": "2021-10-31T11:00:00.000Z"
 *   },
 *   "planName": "Family Cooking",
 *   "planDescription": "Weekly delivery of home cooking recipes and time-saving tips",
 *   "planPrice": "0",
 *   "_createdDate": "2021-09-02T06:13:28.595Z",
 *   "_updatedDate": "2021-09-02T06:13:28.738Z"
 * }
 */
```

---