Payload
The previous section of the documentation describes how to create a webhook. This section focuses on the payload of the POST-requests that the OpenTicket system sends when a webhook is invoked.
There are three different payload structures depending on the type of webhook trigger: Revision, Scan and Order. Revision webhooks are triggered by changes to resources, like Shop or Product, having five type of changes: Create, Update, Delete, Relation, and Reorder. Scan webhooks are triggered when a ticket is scanned. Order webhooks are triggered by order lifecycle events: Placed, Paid, and Updated.
Revision
The structure of the payload Revision is listed below. The outer structure is consistent across all trigger types,
but the change object varies depending on the trigger.
The keys inside props and changes correspond to the fields of each model as documented in the
API reference.
- Create
- Update
- Delete
- Relation
- Reorder
Contains the initial property values of the newly created model.
{
"meta": {
"user_id": "", // GUID of the user that initiated the trigger
"user_name": "", // First and last name of the user, or "anonymous" if hidden
"company_id": "", // GUID of the company within which the trigger was initiated
"company_ids": [], // Array of company GUIDs associated with the trigger
"anonymous": true // Parameter only present when true; when set, user_id is null and user_name is "anonymous"
},
"model": {
"guid": "", // GUID of the model for which the trigger was initiated
"type": "", // Type of the model (e.g. "event", "ticket", "metadata")
"name": "" // Name of the model for which the trigger was initiated
},
"source": "", // Source that initiated the revision
"time": "", // ISO 8601 date and time when the webhook was invoked
"type": "create",
"change": {
"props": { // All current property values
"key_1": {
"val": "...",
"old": null
},
"key_2": {
"val": "...",
"old": null
},
// ...
}
}
}
Contains all current property values and the changed fields.
{
"meta": {
"user_id": "", // GUID of the user that initiated the trigger
"user_name": "", // First and last name of the user, or "anonymous" if hidden
"company_id": "", // GUID of the company within which the trigger was initiated
"company_ids": [], // Array of company GUIDs associated with the trigger
"anonymous": true // Parameter only present when true; when set, user_id is null and user_name is "anonymous"
},
"model": {
"guid": "", // GUID of the model for which the trigger was initiated
"type": "", // Type of the model (e.g. "event", "ticket", "metadata")
"name": "" // Name of the model for which the trigger was initiated
},
"source": "", // Source that initiated the revision
"time": "", // ISO 8601 date and time when the webhook was invoked
"type": "update",
"change": {
"props": { // All current property values
"key_1": {
"val": "new value",
"old": "previous value"
},
"key_2": {
"val": null,
"old": "previous value"
}
},
"changes": { // Only list the changed fields
"key_1": {
"val": "new value",
"old": "previous value"
}
}
}
}
Empty change object, the deleted model is identified by the model field.
{
"meta": {
"user_id": "", // GUID of the user that initiated the trigger
"user_name": "", // First and last name of the user, or "anonymous" if hidden
"company_id": "", // GUID of the company within which the trigger was initiated
"company_ids": [], // Array of company GUIDs associated with the trigger
"anonymous": true // Parameter only present when true; when set, user_id is null and user_name is "anonymous"
},
"model": {
"guid": "", // GUID of the model for which the trigger was initiated
"type": "", // Type of the model (e.g. "event", "ticket", "metadata")
"name": "" // Name of the model for which the trigger was initiated
},
"source": "", // Source that initiated the revision
"time": "", // ISO 8601 date and time when the webhook was invoked
"type": "delete",
"change": {}
}
Describes a change in the relationship between two models.
{
"meta": {
"user_id": "", // GUID of the user that initiated the trigger
"user_name": "", // First and last name of the user, or "anonymous" if hidden
"company_id": "", // GUID of the company within which the trigger was initiated
"company_ids": [], // Array of company GUIDs associated with the trigger
"anonymous": true // Parameter only present when true; when set, user_id is null and user_name is "anonymous"
},
"model": {
"guid": "", // GUID of the model for which the trigger was initiated
"type": "", // Type of the model (e.g. "event", "ticket", "metadata")
"name": "" // Name of the model for which the trigger was initiated
},
"source": "", // Source that initiated the revision
"time": "", // ISO 8601 date and time when the webhook was invoked
"type": "relation",
"change": {
"name": "", // Name of the relation
"create": false, // Whether the relation was newly created
"parent": { // The new parent model
"guid": "",
"type": "",
"name": ""
},
"old_parent": { // The previous parent model, or null
"guid": "",
"type": "",
"name": ""
}
}
}
Describes a reordering of a model relative to another.
{
"meta": {
"user_id": "", // GUID of the user that initiated the trigger
"user_name": "", // First and last name of the user, or "anonymous" if hidden
"company_id": "", // GUID of the company within which the trigger was initiated
"company_ids": [], // Array of company GUIDs associated with the trigger
"anonymous": true // Parameter only present when true; when set, user_id is null and user_name is "anonymous"
},
"model": {
"guid": "", // GUID of the model for which the trigger was initiated
"type": "", // Type of the model (e.g. "event", "ticket", "metadata")
"name": "" // Name of the model for which the trigger was initiated
},
"source": "", // Source that initiated the revision
"time": "", // ISO 8601 date and time when the webhook was invoked
"type": "reorder",
"change": {
"op": "", // Move operation: "before" or "after"
"other": { // The model relative to which the reorder was performed
"guid": "",
"type": "",
"name": ""
},
"relation": { // The relation within which the reorder occurred
"name": "",
"create": false,
"parent": { "guid": "", "type": "", "name": "" },
"old_parent": null
}
}
}
Scan
The structure of the payload for the Scan trigger is a flat object:
{
"scanner_id": "", // GUID of the scanner that performed the scan
"scanner_type_id": "", // GUID of the scanner type
"company_id": "", // GUID of the company
"event_id": "", // GUID of the event
"ticket_id": "", // GUID of the ticket type
"order_id": "", // GUID of the order
"order_ticket_id": "", // GUID of the order ticket that was scanned
"barcode": "", // The barcode that was scanned
"order_product_ids": [], // Array of product GUIDs associated with the scanned ticket
"direction": "", // Scan direction: "in", "out", "check" or "invalid"
"created_at": "", // ISO 8601 date and time when the scan was performed
}
Order
The structure of the payload for order triggers (Paid, Updated, Placed) contains the full order object.
All price fields (original_price, value, service_fee, price) are expressed in the smallest
unit of the currency (e.g. cents for EUR/USD). For example, a price of
1050 represents 10.50 in euros, or 1050 in Icelandic krónur.
{
"guid": "", // GUID of the order
"shop_id": "", // GUID of the shop through which the order was placed
"original_price": 0, // Original price in cents before discounts
"value": 0, // Value in cents
"service_fee": 0, // Service fee in cents
"price": 0, // Total price in cents
"finn_original_price": 0, // Duplicate of original_price (duplicate)
"finn_value": 0, // Duplicate of value (duplicate)
"finn_service_fee": 0, // Duplicate of service_fee (duplicate)
"finn_price": 0, // Duplicate of price (duplicate)
"firstname": "", // First name of the buyer
"lastname": "", // Last name of the buyer
"email": "", // Email address of the buyer
"status": "", // Current status of the order
"techdata": "", // Raw techdata string
"techdata_raw": "", // Raw techdata string (duplicate)
"techdata_decoded": null, // Parsed techdata as JSON if valid, otherwise null
"currency": "", // Currency code (e.g. "EUR")
"locale": "", // Locale (e.g. "nl_NL")
"is_complete": false, // Whether the order is complete
"payment_method_administered": false, // Whether the payment method is administered
"pdf_location": "", // URL of the order PDF, or null
"purchase_channel": "", // Channel through which the order was placed
"is_seated": false, // Whether the order contains seated tickets
"comment": "", // Optional comment on the order
"invalidated_since": null, // ISO 8601 date when the order was invalidated, or null
"invalidated_reason": "", // Reason for invalidation, or null
"created_at": "", // ISO 8601 date when the order was created
"updated_at": "", // ISO 8601 date when the order was last updated
"tracking_info": { // Tracking information
"purchaser_ip_address": "", // IP address of the buyer
"google_client_id": "", // Google Analytics client ID
"click_id": "", // Click ID for ad tracking
"click_id_source": "", // Source of the click ID
"utm_source": "", // UTM source parameter
"utm_medium": "", // UTM medium parameter
"utm_campaign": "", // UTM campaign parameter
"utm_term": "", // UTM term parameter
"eaid": "", // Anonymous ID
"tracker_id": "" // Tracker ID
},
"returns": null, // Returns associated with this order, or null
"payment": { // Payment details, or null
"guid": "", // GUID of the payment
"value": 0, // Payment value in cents
"service_fee": 0, // Service fee in cents
"price": 0, // Total price in cents
"status": "", // Payment status
"payment_method_id": "", // GUID of the payment method
"payment_id": "", // External payment ID
"currency": "", // Currency code
"description": "", // Payment description
"administered": false // Whether the payment is administered
},
"shop": {}, // Shop object, or null
"tickets": [ // Array of order tickets
{
"guid": "", // GUID of the order ticket
"original_id": "", // GUID of the ticket type
"original_price": 0, // Original price in cents
"value": 0, // Value in cents
"inner_value": 0, // Inner value in cents
"service_fee": 0, // Service fee in cents
"price": 0, // Total price in cents
"vat": 0.0, // VAT percentage
"vat_percentage": 0.0, // VAT percentage (duplicate)
"is_complete": false, // Whether the ticket is complete
"ticket_number": "", // Ticket barcode number
"retrievable_after": 0, // Timestamp after which the ticket can be retrieved
"pdf_location": "", // URL of the ticket PDF, or null
"invalidated_since": null, // ISO 8601 date when invalidated, or null
"invalidated_reason": "", // Reason for invalidation
"created_at": "", // ISO 8601 date when created
"updated_at": "", // ISO 8601 date when last updated
"products": [], // Array of order products on this ticket
"metadata": [], // Array of metadata on this ticket
"event_dates": [] // Array of event dates for this ticket
}
],
"products": [], // Array of order product objects
"metadata": [], // Array of order metadata objects
"events": [] // Array of event objects associated with the order
}