onOrderInitiated( )


A backend event that fires when a ticket order is initiated.

The onOrderInitiated() event handler runs when a ticket order is initiated. The received OrderInitiatedEvent object contains information about the initiated ticket order.

Note: Backend events are not fired when previewing your site.

Method Declaration
Copy
function onOrderInitiated(event: OrderInitiatedEvent): void;
Method Parameters
eventOrderInitiatedEventRequired

Information about the ticket order that was initiated.

A backend event that occurs when a ticket order is initiated
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_onOrderInitiated(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; } /* Full event object: * { * "timestamp": "2020-04-28T12:23:51.523Z", * "eventId": "566e7be9-1410-4095-ae7a-349a4ac95c6b", * "orderNumber": "FMXC-BZG3-OT", * "firstName": "John", * "lastName": "Doe", * "email": "john.doe@somedomain.com", * "status": "INITIATED", * "checkoutForm": { * "inputValues": [ * { * "inputName": "firstName", * "value": "John", * "values": [] * }, * { * "inputName": "lastName", * "value": "Doe", * "values": [] * }, * { * "inputName": "email", * "value": "john.doe@somedomain.com", * "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" * } * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?