> For the complete documentation index, see [llms.txt](https://docs.odds88.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.odds88.io/integration-process/recommended-integration-flow/settlement-feed.md).

# Settlement Feed

{% content-ref url="/pages/pCOsbPzku2QUbexzwct0" %}
[Settlement Feed](/odds88-client-api/odds88-feeds/settlement-feed.md)
{% endcontent-ref %}

* Establish connection.
* Process message. Message schema
* Apply settlement results to the ticket in DB, update player balance accordingly.
* Every message has ticket level `settlementTime`, that shows at what time settlement happened. Normally messages are pushed to feed 0.5-2 seconds after settlement happens.
* Multiple settlement messages can be sent for one ticket. If `settlementTime` of ticket received in message is smaller than previously received in settlement message for this ticket, message should be ignored and no changes should be made. Especially important during reconnect/recovery to prevent resettlements of tickets.
* Reconnection should be automatically handled by integration. Automatic Reconnection should happen with **correct** **revision**.
* `revision` is a UNIX timestamp seconds. In case of reconnection it should have a timestamp of 1 minute before the last settlement message received. Duplicated messages expected and should be ignored. Maximum recovery period is 3 days.
* There are endpoints that can be used to get the latest result/status of specific tickets. We recommend implementing these endpoints in your backend/backoffice to get results manually if needed.
* Settlement of tickets, without interaction with Odds88 endpoints should be possible from your backoffice in case it is not possible to do it any other way.

### **Heartbeat Support** <a href="#id-5.-heartbeat-support" id="id-5.-heartbeat-support"></a>

The new endpoint supports heartbeat messages so it's possible to differentiate idle periods from technical issues.

**Heartbeat Timing**

* Heartbeat every **10 seconds**
* Expected flow: Delta **or** Heartbeat message

**Connection Timeout Rules**\
If there is no delta **or** heartbeat messages received for 30 seconds then it's required to close current connection and reconnect using **LastUpdatedTime** from last processed message.\
Our system closes stale connections automatically.

### **Message Wrapper Structure** <a href="#id-6.-message-wrapper-structure" id="id-6.-message-wrapper-structure"></a>

All messages (deltas or heartbeats) are wrapped in the following structure:

```json
{
  "Payload": "Nullable<DeltaDto>",      /// Message payload. Null for ping messages.
  "PingId": "Nullable<string>",         /// Non-null only for ping messages.
  "TimestampUtc": "DateTime",           /// UTC timestamp when the message was generated by the Odds88 engine.
  "PublishTimestampUtc": "DateTime"     /// UTC timestamp when the message was published to the client.
}
```
