> For the complete documentation index, see [llms.txt](https://scorpioplay.gitbook.io/scorpio-play-casino-api-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scorpioplay.gitbook.io/scorpio-play-casino-api-doc/api-reference/images-and-media/win.md).

# Win

When a player wins, our API will send a callback request to credit the win amount to the player's balance and retrieve the updated balance.

{% hint style="warning" %}
This is an idempotent operation. If the wallet receives more than one request with the same `transactionId` the transaction must be registered only once in the wallet.
{% endhint %}

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>URL</td><td>{operatorCallbackURL}</td></tr><tr><td>Method</td><td>POST</td></tr><tr><td>Headers</td><td>X-Request-Signature<br>Content-Type<br>Accept</td></tr><tr><td>Request Body</td><td><pre class="language-json"><code class="lang-json">{
   command: "win",
   transactionId: "SP215202",
   playerId: "1101",
   roundId: "65215842315484512",
   providerId: 2,
   providerName: "EGT Digital",
   gameCode: "FSHBLSlot",
   gameName: "40 Burning Hot Bell Link",
   currency: "EUR",
   amount: 100,
   isRoundFinished: true,
   isCall: false,
   timestamp: 1586335186372
}
</code></pre></td></tr><tr><td>Response Body</td><td><pre class="language-json"><code class="lang-json">{
   balance: 1591.52,
   statusCode: "OK"
}
</code></pre></td></tr></tbody></table>

## Request

<table><thead><tr><th width="146">Parameter</th><th width="107">Values</th><th width="104">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><strong>command</strong></td><td>string</td><td>Y</td><td>Indicates the request type.</td></tr><tr><td><strong>transactionId</strong></td><td>string</td><td>Y</td><td>Unique reference of the transaction created in our API.</td></tr><tr><td><strong>playerId</strong></td><td>string</td><td>Y</td><td>Unique identifier of the player from the operator's<br>system.</td></tr><tr><td><strong>roundId</strong></td><td>string</td><td>Y</td><td>Unique reference of the game round.</td></tr><tr><td><strong>providerId</strong></td><td>number</td><td>Y</td><td>Unique identifier of the provider in our API.</td></tr><tr><td><strong>providerName</strong></td><td>string</td><td>Y</td><td>The name of the provider.</td></tr><tr><td><strong>gameCode</strong></td><td>string</td><td>Y</td><td>Unique identifier of the game in our API</td></tr><tr><td><strong>gameName</strong></td><td>string</td><td>Y</td><td>The name of the game.</td></tr><tr><td><strong>currency</strong></td><td>string</td><td>Y</td><td>Player currency, according to ISO-4217 (EUR, USD ...)</td></tr><tr><td><strong>amount</strong></td><td>number</td><td>Y</td><td>Transfer amount.</td></tr><tr><td><strong>isRoundFinished</strong></td><td>boolean</td><td>Y</td><td>Indecates whether the round is finished or not.<br>If true, no other "win" callbacks will be sent after this callback, but if false, other corresponding callbacks will be sent.</td></tr><tr><td><strong>isCall</strong></td><td>boolean</td><td>Y</td><td>If true, Player is in undergoing bonus call event.</td></tr><tr><td><strong>timestamp</strong></td><td>number</td><td>Y</td><td>Timestamp of the request.</td></tr></tbody></table>

## Response

<table><thead><tr><th width="146">Parameter</th><th width="107">Values</th><th width="104">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><strong>balance</strong></td><td>number</td><td>Y</td><td>Player balance.</td></tr><tr><td><strong>statusCode</strong></td><td>string</td><td>Y</td><td>Status code of the execution.</td></tr></tbody></table>

## Possible Status Codes

| Status codes                  | Reason                          |
| ----------------------------- | ------------------------------- |
| OK                            | Request successful              |
| ERR\_INTEGRITY\_CHECK\_FAILED | Message integrity check failed. |
| ERR\_NOT\_AUTHENTICATED       | Player is not authenticated     |
| ERR\_UNKNOWN                  | Internal server error           |

In case `statusCode` is different than "OK", the request will be treated as unsuccessful.&#x20;

{% hint style="info" %}
A response must be provided within 4 seconds. If the callback request times out or returns a specific error, our API will automatically retry the request up to two more times.
{% endhint %}

## Example

### Request

```json
{
   command: "win",
   transactionId: "SP215202",
   playerId: "1101",
   roundId: "65215842315484512",
   providerId: 2,
   providerName: "EGT Digital",
   gameCode: "FSHBLSlot",
   gameName: "40 Burning Hot Bell Link",
   currency: "EUR",
   amount: 100,
   isRoundFinished: true,
   isCall: false,
   timestamp: 1586335186372
}
```

### OK Response

<pre class="language-json"><code class="lang-json">{
<strong>    "balance": 19839891,
</strong>    "statusCode": "OK"
}
</code></pre>

### Error Response

```json
{
    "statusCode": "ERR_UNKNOWN",
    "balance": 19839880
}
```
