Search...
onOrderConfirmed( )
A backend event that fires when a ticket order is confirmed.
Description
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.
Syntax
function onOrderConfirmed(event: OrderConfirmedEvent): void
onOrderConfirmed Parameters
NAME
TYPE
DESCRIPTION
event
OrderConfirmedEvent
Information about the ticket order that was confirmed.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
A backend event that occurs when a ticket order is confirmed
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.3// Add the file if it doesn't exist.45export function wixEvents_onOrderConfirmed(event) {6 let eventId = event.eventId;7 let orderNumber = event.orderNumber;8 let status = event.status;910 let buyerFirstName = event.firstName;11 let buyerLastName = event.lastName;12 let buyerEmail = event.email;1314 let invoice = event.invoice;15 let grandTotal = invoice.grandTotal;1617 let tickets = event.tickets;18 let firstTicket = tickets[0];19 let secondTicket = tickets[1];20}212223/* Full event object:24 * {25 * "timestamp": "2020-04-28T12:23:57.154Z",26 * "eventId": "566e7be9-1410-4095-ae7a-349a4ac95c6b",27 * "orderNumber": "FMXC-BZG3-OT",28 * "contactId": "eea3ac0f-f9e6-4ed3-a135-99743c8e90b8",29 * "memberId": "b272b0bb-d013-415a-8461-e8a175fe8dc6",30 * "created": "2020-04-28T12:23:51.523Z",31 * "firstName": "John",32 * "lastName": "Doe",33 * "email": "john.doe@somedomain.com",34 * "status": "PAID",35 * "method": "payPal",36 * "checkoutForm": {37 * "inputValues": [38 * {39 * "inputName": "firstName",40 * "value": "John",41 * "values": []42 * },43 * {44 * "inputName": "lastName",45 * "value": "Doe",46 * "values": []47 * },48 * {49 * "inputName": "email",50 * "value": "john.doe@somedomain.com",51 * "values": []52 * }53 * ]54 * },55 * "tickets": [56 * {57 * "ticketNumber": "FMXC-BZG3-OT021",58 * "ticketDefinitionId": "d72874cb-012a-4ad2-afbb-57fe8cf1e308",59 * "price": {60 * "amount": "123.00",61 * "currency": "USD"62 * },63 * "firstName": "John",64 * "lastName": "Doe",65 * "email": "john.doe@somedomain.com",66 * "contactId": "eea3ac0f-f9e6-4ed3-a135-99743c8e90b8",67 * "memberId": "b272b0bb-d013-415a-8461-e8a175fe8dc6",68 * "confirmed": true,69 * "form": {70 * "inputValues": [71 * {72 * "inputName": "custom",73 * "value": "Another comment",74 * "values": []75 * },76 * {77 * "inputName": "email",78 * "value": "john.doe@somedomain.com",79 * "values": []80 * },81 * {82 * "inputName": "lastName",83 * "value": "Doe",84 * "values": []85 * },86 * {87 * "inputName": "firstName",88 * "value": "John",89 * "values": []90 * },91 * {92 * "inputName": "date",93 * "value": "2020-04-28",94 * "values": []95 * },96 * {97 * "inputName": "comment",98 * "value": "Comment",99 * "values": []100 * },101 * {102 * "inputName": "address",103 * "value": "",104 * "values": [105 * "Wix Playground, 100 Gansevoort St",106 * "New York City",107 * "New York",108 * "USA",109 * "NY 10014"110 * ]111 * },112 * {113 * "inputName": "phone",114 * "value": "(555) 555-1234",115 * "values": []116 * }117 * ]118 * }119 * },120 * {121 * "ticketNumber": "FMXC-BZG3-OT041",122 * "ticketDefinitionId": "9c3dc432-f1a6-408f-82d8-4f64c7ff581b",123 * "price": {124 * "amount": "0.00",125 * "currency": "USD"126 * },127 * "firstName": "Jane",128 * "lastName": "Doe",129 * "email": "jane.doe@somedomain.com",130 * "contactId": "e11af3d4-c205-4d3a-b687-58d4dda78a6c",131 * "memberId": "62bc4004-548c-46ad-a699-55ef307273e3",132 * "confirmed": true,133 * "form": {134 * "inputValues": [135 * {136 * "inputName": "custom",137 * "value": "Another comment",138 * "values": []139 * },140 * {141 * "inputName": "email",142 * "value": "jane.doe@somedomain.com",143 * "values": []144 * },145 * {146 * "inputName": "lastName",147 * "value": "Doe",148 * "values": []149 * },150 * {151 * "inputName": "firstName",152 * "value": "Jane",153 * "values": []154 * },155 * {156 * "inputName": "date",157 * "value": "2020-04-28",158 * "values": []159 * },160 * {161 * "inputName": "comment",162 * "value": "Comment",163 * "values": []164 * },165 * {166 * "inputName": "address",167 * "value": "",168 * "values": [169 * "Wix Playground, 100 Gansevoort St",170 * "New York City",171 * "New York",172 * "USA",173 * "NY 10014"174 * ]175 * },176 * {177 * "inputName": "phone",178 * "value": "(555) 555-1234",179 * "values": []180 * }181 * ]182 * }183 * }184 * ],185 * "invoice": {186 * "items": [187 * {188 * "id": "d72874cb-012a-4ad2-afbb-57fe8cf1e308",189 * "quantity": 1,190 * "name": "VIP",191 * "price": {192 * "amount": "123.00",193 * "currency": "USD"194 * },195 * "total": {196 * "amount": "123.00",197 * "currency": "USD"198 * },199 * "fees": [200 * {201 * "type": "FEE_INCLUDED",202 * "rate": "2.5",203 * "amount": {204 * "amount": "3.08",205 * "currency": "USD"206 * }207 * }208 * ]209 * },210 * {211 * "id": "9c3dc432-f1a6-408f-82d8-4f64c7ff581b",212 * "quantity": 1,213 * "name": "Free",214 * "price": {215 * "amount": "0.00",216 * "currency": "USD"217 * },218 * "total": {219 * "amount": "0.00",220 * "currency": "USD"221 * },222 * "fees": [223 * {224 * "rate": "2.5",225 * "amount": {226 * "amount": "0.00",227 * "currency": "USD"228 * }229 * }230 * ]231 * }232 * ],233 * "fees": [234 * {235 * "rate": "2.5",236 * "amount": {237 * "amount": "0.00",238 * "currency": "USD"239 * }240 * },241 * {242 * "type": "FEE_INCLUDED",243 * "rate": "2.5",244 * "amount": {245 * "amount": "3.08",246 * "currency": "USD"247 * }248 * }249 * ],250 * "subTotal": {251 * "amount": "123.00",252 * "currency": "USD"253 * },254 * "grandTotal": {255 * "amount": "123.00",256 * "currency": "USD"257 * },258 * "revenue": {259 * "amount": "119.92",260 * "currency": "USD"261 * }262 * }263 * }264 */