> 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: onOrderConfirmed(event: OrderConfirmedEvent)

# Method package: wixEventsBackend

# Method menu location: wixEventsBackend --> Events --> onOrderConfirmed

# Method Link: https://dev.wix.com/docs/velo/apis/wix-events-backend/events/on-order-confirmed.md

# Method Description:

A backend event that fires when a ticket order is confirmed.

The `onOrderConfirmed()` event handler runs when a ticket order is confirmed.
 The received `OrderConfirmedEvent`
 object contains information about the confirmed ticket order.

> **Note:** Backend events are **not** fired when previewing your site.



# Method Code Examples:

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

## A backend event that occurs when a ticket order is confirmed

```javascript
// Place this code in the events.js file
// of your site's Backend section. 
// Add the file if it doesn't exist.

export function wixEvents_onOrderConfirmed(event) {
    let eventId = event.eventId;
    let orderNumber = event.orderNumber;
    let status = event.status;

    let buyerFirstName = event.firstName;
    let buyerLastName = event.lastName;
    let buyerEmail = event.email;

    let invoice = event.invoice;
    let grandTotal = invoice.grandTotal;

    let tickets = event.tickets;
    let firstTicket = tickets[0];
    let secondTicket = tickets[1];
}


/*  Full event object:
 *  {
 *    "timestamp": "2020-04-28T12:23:57.154Z",
 *    "eventId": "566e7be9-1410-4095-ae7a-349a4ac95c6b",
 *    "orderNumber": "FMXC-BZG3-OT",
 *    "contactId": "eea3ac0f-f9e6-4ed3-a135-99743c8e90b8",
 *    "memberId": "b272b0bb-d013-415a-8461-e8a175fe8dc6",
 *    "created": "2020-04-28T12:23:51.523Z",
 *    "firstName": "John",
 *    "lastName": "Doe",
 *    "email": "john.doe@somedomain.com",
 *    "status": "PAID",
 *    "method": "payPal",
 *    "checkoutForm": {
 *      "inputValues": [
 *        {
 *          "inputName": "firstName",
 *          "value": "John",
 *          "values": []
 *        },
 *        {
 *          "inputName": "lastName",
 *          "value": "Doe",
 *          "values": []
 *        },
 *        {
 *          "inputName": "email",
 *          "value": "john.doe@somedomain.com",
 *          "values": []
 *        }
 *      ]
 *    },
 *    "tickets": [
 *      {
 *        "ticketNumber": "FMXC-BZG3-OT021",
 *        "ticketDefinitionId": "d72874cb-012a-4ad2-afbb-57fe8cf1e308",
 *        "price": {
 *          "amount": "123.00",
 *          "currency": "USD"
 *        },
 *        "firstName": "John",
 *        "lastName": "Doe",
 *        "email": "john.doe@somedomain.com",
 *        "contactId": "eea3ac0f-f9e6-4ed3-a135-99743c8e90b8",
 *        "memberId": "b272b0bb-d013-415a-8461-e8a175fe8dc6",
 *        "confirmed": true,
 *        "form": {
 *          "inputValues": [
 *            {
 *              "inputName": "custom",
 *              "value": "Another comment",
 *              "values": []
 *            },
 *            {
 *              "inputName": "email",
 *              "value": "john.doe@somedomain.com",
 *              "values": []
 *            },
 *            {
 *              "inputName": "lastName",
 *              "value": "Doe",
 *              "values": []
 *            },
 *            {
 *              "inputName": "firstName",
 *              "value": "John",
 *              "values": []
 *            },
 *            {
 *              "inputName": "date",
 *              "value": "2020-04-28",
 *              "values": []
 *            },
 *            {
 *              "inputName": "comment",
 *              "value": "Comment",
 *              "values": []
 *            },
 *            {
 *              "inputName": "address",
 *              "value": "",
 *              "values": [
 *                "Wix Playground, 100 Gansevoort St",
 *                "New York City",
 *                "New York",
 *                "USA",
 *                "NY 10014"
 *              ]
 *            },
 *            {
 *              "inputName": "phone",
 *              "value": "(555) 555-1234",
 *              "values": []
 *            }
 *          ]
 *        }
 *      },
 *      {
 *        "ticketNumber": "FMXC-BZG3-OT041",
 *        "ticketDefinitionId": "9c3dc432-f1a6-408f-82d8-4f64c7ff581b",
 *        "price": {
 *          "amount": "0.00",
 *          "currency": "USD"
 *        },
 *        "firstName": "Jane",
 *        "lastName": "Doe",
 *        "email": "jane.doe@somedomain.com",
 *        "contactId": "e11af3d4-c205-4d3a-b687-58d4dda78a6c",
 *        "memberId": "62bc4004-548c-46ad-a699-55ef307273e3",
 *        "confirmed": true,
 *        "form": {
 *          "inputValues": [
 *            {
 *              "inputName": "custom",
 *              "value": "Another comment",
 *              "values": []
 *            },
 *            {
 *              "inputName": "email",
 *              "value": "jane.doe@somedomain.com",
 *              "values": []
 *            },
 *            {
 *              "inputName": "lastName",
 *              "value": "Doe",
 *              "values": []
 *            },
 *            {
 *              "inputName": "firstName",
 *              "value": "Jane",
 *              "values": []
 *            },
 *            {
 *              "inputName": "date",
 *              "value": "2020-04-28",
 *              "values": []
 *            },
 *            {
 *              "inputName": "comment",
 *              "value": "Comment",
 *              "values": []
 *            },
 *            {
 *              "inputName": "address",
 *              "value": "",
 *              "values": [
 *                "Wix Playground, 100 Gansevoort St",
 *                "New York City",
 *                "New York",
 *                "USA",
 *                "NY 10014"
 *              ]
 *            },
 *            {
 *              "inputName": "phone",
 *              "value": "(555) 555-1234",
 *              "values": []
 *            }
 *          ]
 *        }
 *      }
 *    ],
 *    "invoice": {
 *      "items": [
 *        {
 *          "id": "d72874cb-012a-4ad2-afbb-57fe8cf1e308",
 *          "quantity": 1,
 *          "name": "VIP",
 *          "price": {
 *            "amount": "123.00",
 *            "currency": "USD"
 *          },
 *          "total": {
 *            "amount": "123.00",
 *            "currency": "USD"
 *          },
 *          "fees": [
 *            {
 *              "type": "FEE_INCLUDED",
 *              "rate": "2.5",
 *              "amount": {
 *                "amount": "3.08",
 *                "currency": "USD"
 *              }
 *            }
 *          ]
 *        },
 *        {
 *          "id": "9c3dc432-f1a6-408f-82d8-4f64c7ff581b",
 *          "quantity": 1,
 *          "name": "Free",
 *          "price": {
 *            "amount": "0.00",
 *            "currency": "USD"
 *          },
 *          "total": {
 *            "amount": "0.00",
 *            "currency": "USD"
 *          },
 *          "fees": [
 *            {
 *              "rate": "2.5",
 *              "amount": {
 *                "amount": "0.00",
 *                "currency": "USD"
 *              }
 *            }
 *          ]
 *        }
 *      ],
 *      "fees": [
 *        {
 *          "rate": "2.5",
 *          "amount": {
 *            "amount": "0.00",
 *            "currency": "USD"
 *          }
 *        },
 *        {
 *          "type": "FEE_INCLUDED",
 *          "rate": "2.5",
 *          "amount": {
 *            "amount": "3.08",
 *            "currency": "USD"
 *          }
 *        }
 *      ],
 *      "subTotal": {
 *        "amount": "123.00",
 *        "currency": "USD"
 *      },
 *      "grandTotal": {
 *        "amount": "123.00",
 *        "currency": "USD"
 *      },
 *      "revenue": {
 *        "amount": "119.92",
 *        "currency": "USD"
 *      }
 *    }
 *  }
 */
```

---