{% extends 'Layouts/Doc/default.html.twig' %} {% block title %}{{ 'app.documentation.menu.webhook.events'|trans }}{% endblock %} {% block headerPageTitle %}WEBHOOK {{ 'app.documentation.menu.webhook.events_order'|trans|upper }}{% endblock %} {% block body %}

Learn about webhooks and how events are triggered for your account

Webhooks allow you to automate custom backend actions in response to the transitions that happen in a order & payment flows.

Events overview

Events are our way of letting you know when something interesting happens in your account. When an event occurs, we create a new Event object. If you registered a webhook endpoint to receive that event, we send it to your endpoint as part of a POST request.

Example event

The following event shows an order cancellation. To generate a similar event, you can use action list on your Popina Order dashboard or via our API.


{
  "object": "order",
  "created": "2023-06-06T14:36:37.000000+00:00",
  "event": "late", //{{ checkoutConstants|join(', ', ' or ') }}
  "parameters": {
      "period": 16,
      "newDate": "2023-06-06 16:46"
  },
  "data": {
      "id": 2170,
      "createdAt": "2023-06-06T14:36:37.000000+00:00",
      "date": "2023-06-06T16:30:21.000000+00:00",
      "asap": false,
      "preparationNumber": 4,
      "tableNumber": 23,
      "notes": null,
      "state": "in_progress", //{{ orderConstants|join(', ', ' or ') }}
      "paymentState": "paid", //{{ paymentConstants|join(', ', ' or ') }}
      "itemsTotal": 2400,
      "discountsTotal": 0,
      "managementFees": 0,
      "shippingCost": 0,
      "fees": 0,
      "total": 2400,
      "source": "popina",
      "createdByGuest": false,
      "deliveryAddress": {
          "name": "Boulot",
          "phone": "0987898789",
          "phone2": null,
          "street": "3 rue théodore blanc",
          "street2": null,
          "buildingType": "résidence",
          "building": null,
          "floor": "12",
          "elevator": true,
          "intercom": null,
          "postalCode": "33520",
          "fax": null,
          "city": "Bruges",
          "country": "France",
          "description": null,
          "longitude": -0.612747,
          "latitude": 44.881793
      },
      "externalId": null,
      "promotion": {
          "id": 33,
          "name": "Black friday",
          "type": "value",
          "value": 1000,
          "code": "black-friday",
          "imageUrl": null
      },
      "customer": {
          "id": 927,
          "email": "test@email.com",
          "firstName": "firstName",
          "lastName": "lastName",
          "phone": "0987898789",
          "anonymous": false
      },
      "shop": {
          "id": 34,
          "name": "shop"
      },
      "shopMode": {
          "id": 25,
          "mode": {
            "code": "take-out", //{{ modeConstants|join(', ', ' or ') }}
            "name": "Emporter"
          }
      },
      "payment": [
        {
          "id": 1888,
          "paymentAmount": 2400,
          "state": "paid",
          "createdAt": "2024-02-06 15:46:53",
          "updatedAt": "2024-02-06 15:47:08",
          "paymentMethodCode": "paygreen",
          "paymentMethodName": "Paygreen"
        }
      ],
      "setting": {
        "customerIdentifier": "beeper", //{{ customerIdentifierConstants|join(', ', ' or ') }}
        "value": "4",
        "cutlery": true
      },
      "loyalty": {
        "customer": {
            "id": "2b630af8-d94f-4db9-a203-795338461ce8",
            "firstName": "John",
            "lastName": "Doe",
            "phone": "+33652187094",
            "email": "john@doe.com"
        },
        "rewards": [
          {
            "id": "rew_52431421b6",
            "name": "5€ off your next order",
            "description": "Get 5€ off your next order with this reward.",
            "type": "AMOUNT", //{{ loyaltyBenefitTypeConstants|join(', ', ' or ') }}
            "image": null,
            "value": 500,
            "couponCode": null,
            "productSku": null,
            "productId": null,
            "hash": "3ed3dc62e263a358991fc204c5b14eec374f6ef9",
          }
        ]
      },
      "orderItems": [
        {
          "id": 2630,
          "note": "Pas d'oignion",
          "quantity": 1,
          "unitPrice": 1000,
          "unitsTotal": 1000,
          "discountsTotal": 0,
          "taxesTotal": 58.54,
          "total": 1000,
          "free": false,
          "serveLater": false,
          "product": {
            "id": 515,
            "externalId": null,
            "name": "BURGER",
            "price": "100",
            "tax": {
              "rate": 0.025
            },
            "options": [
              {
                "id": 456,
                "externalId": null,
                "sideComponent": false,
                "name": "Huile d'olive épicée",
                "optionVariant": [
                  {
                    "id": 3809,
                    "externalId": null,
                    "sideComponent": null,
                    "name": "Huile d'olive épicée",
                    "price": 200,
                    "quantity": 0
                  }
                ],
                "position": 2,
              }
            ],
            "sku": "FOX_6735EF3F27F22",
            "imageUrl": "uploads\/images\/products\/\/banniere-65af9d0ba203e645672473.jpeg",
            "categories": [
              {
                "id": 91,
                "externalId": null,
                "sideComponent": null,
                "name": "BURGER SEMAINE"
              }
            ]
          },
          "stepList": [
            {
              "id": 2,
              "name": "Choix du Burger ? 🍔",
              "stepItem": {
                "id": 52,
                "products": [
                  {
                    "id": 1876,
                    "calory": null,
                    "withAlcool": false,
                    "serveLater": false,
                    "new": false,
                    "blockedBySlot": false,
                    "restricted": false,
                    "options": [],
                    "aliments": [
                      {
                        "id": 33,
                        "code": "ONION",
                        "logoUrl": "uploads/images/aliments//oignon-667c269ca64a2533576624.png",
                        "logoSvgFile": null,
                        "logoSvgUrl": null,
                        "enabled": true,
                        "svg": null,
                        "translations": [
                          {
                            "locale": "fr_FR",
                            "name": "Oignon",
                            "description": null
                          },
                          {
                            "locale": "es_ES",
                            "name": "Cebolla",
                            "description": null
                          },
                          {
                            "locale": "en_US",
                            "name": "Onion",
                            "description": null
                          }
                        ]
                      }
                    ],
                    "upSellingProducts": [],
                    "crossSellingProducts": [],
                    "outOfStock": false,
                    "preparationTime": 0,
                    "sku": "FOX_669E5187E5510",
                    "displayNotes": true,
                    "type": "product",
                    "steps": [],
                    "enabled": true,
                    "externalId": null,
                    "imageUrl": null,
                    "modes": [
                      {
                        "id": 5043,
                        "code": "on-site",
                        "anonymous": true,
                        "price": 400,
                        "tax": {
                          "rate": 0.21
                        },
                        "enabled": true
                      },
                      {
                        "id": 5044,
                        "code": "take-out",
                        "anonymous": true,
                        "price": 400,
                        "tax": {
                          "rate": 0.21
                        },
                        "enabled": true
                      },
                      {
                        "id": 5045,
                        "code": "delivery",
                        "anonymous": true,
                        "price": 400,
                        "tax": {
                          "rate": 0.21
                        },
                        "enabled": true
                      }
                    ],
                    "translations": [
                      {
                        "locale": "fr_FR",
                        "id": 4440,
                        "name": "T GIANT",
                        "description": "L'icône de toutes les générations, rendue célèbre grâce à sa sauce Giant inimitable. (Origine viande bovine possible : France / Espagne / Pologne)"
                      },
                      {
                        "locale": "es_ES",
                        "id": 5881,
                        "name": "T GIGANTE",
                        "description": "El icono de todas las generaciones, que se hizo famoso gracias a su inimitable salsa Giant. (Posible origen vacuno: Francia / España / Polonia)"
                      },
                      {
                        "locale": "en_US",
                        "id": 6077,
                        "name": "T GIANT",
                        "description": "The icon of all generations, made famous thanks to its inimitable Giant sauce. (Possible beef origin: France / Spain / Poland)"
                      }
                    ],
                    "name": "T GIANT",
                    "tax": {
                      "rate": 0.21
                    }
                  }
                ],
                "price": 0
              },
              "stepTotalPrice": 0
            }
          ]
        }
      ]
    }
  }

Event object structure

object

The concerned object with this event. Up to now we manage only order. But you should take it into consideration so there can be no mistaking with other objects in the future.

created

The date and time when this event occured.

event

{% include 'Doc/States/Checkout/checkout.html.twig' %}

parameters

Additional parameters, used to highlight special data by event:

  • Delay:
    • period: The period of delay applied on order in minutes.
    • newDate: The new preparation date after delay.

data

The new data for this object.

Examples

                                    
{% include 'Doc/Json/order-mode-on-site-with-logged-user-and-promotion.json' %}
                                    
                                
                                    
{% include 'Doc/Json/order-mode-take-out-with-logged-user.json' %}
                                    
                                
                                  
{% include 'Doc/Json/order-mode-take-out-with-logged-user-and-cashback-payment-method.json' %}
                                  
                                  
                                    
{% include 'Doc/Json/order-mode-take-out-with-multiple-payment.json' %}
                                    
                                
                                    
{% include 'Doc/Json/order-mode-on-site-anonymous-user.json' %}
                                    
                                
                                    
{% include 'Doc/Json/order-mode-delivery.json' %}
                                    
                                
{% endblock %} {% block stylesheets %} {% endblock %}