Why use webhooks?

When building the store with Fungies, you might want your applications to receive events as they occur in your Fungies accounts, so that your backend systems can execute actions accordingly.

To enable webhook events, you need to register webhook endpoints. After you register them, Fungies can push real-time event data to your application’s webhook endpoint when events happen in your account. Fungies uses HTTPS to send webhook events to your app as a JSON payload that includes an Event object.

Receiving webhook events is particularly useful for listening to asynchronous events such as when a customer’s order is fulfilled.

Webhook endpoint

When the event occurs, Fungies sends a payload to the webhook endpoint URL as an HTTP POST request. Fungies expects a 2xx response to the HTTP POST request.

When there is no error from the registered endpoint URL, at least once delivery is guaranteed. In the event of an error, the call will be retried 5 times.

Example event payload

{
  "id": "6f97c060-570d-46e8-81af-033539210df3",
  "data": {
    "items": [
      {
        "id": "a0bf335d-25b9-4eda-bf92-f45f7bd2ed18",
        "name": "Legendary Sword",
        "quantity": "1",
        "internalId": null
      }
    ],
    "order": {
      "id": "a41dc391-8475-48ea-916a-e730c7a9708d",
      "fee": 96,
      "tax": 276,
      "value": 1200,
      "country": "US",
      "currency": "USD",
      "totalItems": 1,
      "orderNumber": "113",
      "currencyDecimals": 2
    },
    "customer": {
      "email": "player123@customer.com"
    }
  },
  "type": "payment_success",
  "idempotencyKey": "6f97c060-570d-46e8-81af-033539210df3"
}

Webhook secret

You can also add a secret to your webhook endpoint. This secret is used to create a hash signature of the payload, which is included in each request as an x-fngs-signature header. This allows you to verify that the payload was sent by Fungies and not a third party.