Copystake Integration
CopyStake overview
CopyStake consists of two parts:
Lobby. The page of active streamers (with video stream) and regular users actively playing allowed games;
Broadcast. The page of the selected streamer, where the live stream is displayed (or if it's a regular user, an animation will be shown), where the user can watch the stream, monitor the streamer's bets, and start a copy round;
CopyStake admin configuration:
Operator settings. To integrate CopyStake, the Operator needs to implement the API contract (provided below) and specify the following information on the Admin CopyStake page:
X-API-KEY - CopyStake will make requests to the Operator with this value in the requestโs header;
session TTL - needs to synchronize the session duration between the Operator and CopyStake;
callback URL - for sending requests from CopyStake
CopyStake settings. A section necessary for configuring games to be added to the whitelist, creating streamers, scheduling video streams, and more.
API Access:
all requests from Copystake to Operator contain X-API-KEY with value issued by Operator;
all requests from Operator to Copystake contain X-API-KEY with value issued by Copystake;
Signature:
all requests from must be signed by and verified by Operator;
all requests from Operator must be signed by Operator and verified by CopyStake;
secretKey for signing the payload in both cases is issued by CopyStake
the signature will be placed in the X-REQUEST-SIGNATURE header of each request and uses Base64(HmacSHA512(SecretKey, MD5(request body)))
dealing with X-REQUEST-SIGNATURE
Callback URL:
callback_url
- provided by Operator, e.g.callback_url=https://integration.operator.com/api/v1/copystake
Original and Copied transactions
Get CopyStake page
This API method allows operators to obtain a link to the CopyStake page, which can be embedded as an iframe into the operator's website.
POST
https://integration.trueplay.io/api/v1/copystake/init
Headers
Request
Field | Type | Require | Description |
userId | String | mandatory | User identifier in the operator system |
sessionId | String | optional | Unique session identifier in the operator system. If not provided, it will be generated by CopyStake |
currency | String | mandatory | User's active currency (ISO 4217) |
balance | Double | mandatory | User's current balance in the operator system, rounded to 8 decimal places |
language | String | optional | User's UI language code from the permitted set in the backoffice (ISO 639) |
streamId | String | optional | User identifier for active stream. If present, followers are directed to the Broadcast page, skipping the Lobby |
Response success
Field | Type | Require | Description |
url | String | mandatory | CopyStake URL with an authentication token |
sessionId | String | mandatory | Unique session identifier in the operator system. If not provided, it will be generated by CopyStake |
Response error
HTTP 400 Bad Request
Field | Type | Require | Description |
errorCode | String | mandatory | ERR_UNKNOWN General error status, for cases without a special error code. ERR_COPYSTAKE_OFF CopyStake is disabled |
errorMessage | String | optional | more detailed description of the error |
Response example
Get CopyStake page DEMO
This API method allows operators to obtain a link to the CopyStake page, which can be opened in demo mode within an iframe on the operatorโs website.
POST
https://integration.trueplay.io/api/v1/copystake/init-demo
Headers
Request
Field | Type | Require | Description |
language | String | optional | User's UI language code from the permitted set in the backoffice (ISO 639) |
streamId | String | optional | User identifier for active stream. If present, followers are directed to the Broadcast page, skipping the Lobby |
Response success
Field | Type | Require | Description |
url | String | mandatory | CopyStake url with auth token |
Response error HTTP
400 Bad Request
Field | Type | Require | Description |
errorCode | String | mandatory | ERR_UNKNOWN General error status, for cases without a special error code. ERR_COPYSTAKE_OFF CopyStake is disabled |
errorMessage | String | optional | more detailed description of the error |
Response example
Send game transaction
This method allows operators to send transaction data to Trueplay. Operators must provide the relevant details of each transaction.
POST
https://{operator-name}.proxy.trueplay.io/api/v1/accept
Headers
Field | Type | Require | Description |
userId | String | mandatory | User identifier in the operator system |
transactionId | String | mandatory | Unique identifier for the transaction |
referenceTransactionId | String | optional | Reference to the original (BET | WIN) transaction. This is required to be sent ROLLBACK type transaction |
type | String | mandatory | Type of game transaction (BET | WIN | ROLLBACK | BONUS_BET | BONUS_WIN) |
gameProvider | String | mandatory | The providerโs name. Please use Copystake for sending transactions made in Copystake. |
gameCode | String | mandatory | Unique game code |
gameName | String | mandatory | The gameโs name |
gameType | String | mandatory | The type of game |
currency | String | mandatory | User's active currency (ISO 4217) |
amount | Double | mandatory | Amount involved in the transaction, rounded to 8 decimal places. |
Get user balance
This method retrieves the current available balance of a user during the opening of the Broadcast page and before starting the copy round.
POST
Headers
Request
Field | Type | Require | Description |
sessionId | String | mandatory | unique session identifier |
Response
Field | Type | Require | Description |
balance | Double | mandatory |
|
currency | String | mandatory | user's active currency ISO 4217 |
Send copied transactions (BET/WIN/ROLLBACK)
Send BET copied transaction
This API method sends a BET copied transaction to the operator immediately after receiving the transaction from the streamer during an active game round.
POST
Headers
Request
Field | Type | Require | Description |
sessionId | String | mandatory | Unique session identifier |
roundId | String | mandatory | Unique round identifier representing one copy cycle (some number of game actions) |
transactionId | String | mandatory | Unique CopyStake transaction identifier |
transactionIdOriginal | String | mandatory | Original transaction identifier (the streamer's transaction) |
currency | String | mandatory | User's active currency (ISO 4217) |
amount | Double | mandatory | Amount, rounded to 8 decimal places, representing the "copied" action's amount to interact with the user's balance on the operator side |
Response
Field | Type | Require | Description |
balance | Double | mandatory | Current available user's balance, rounded to 8 decimal places |
currency | String | mandatory | User's active currency (ISO 4217) |
Response error HTTP 400 Bad Request
Field | Type | Require | Description |
errorCode | String | mandatory | ERR_UNKNOWN General error status, for cases without a special error code. |
errorMessage | String | optional | More detailed description of the error |
Response example
Send WIN copied transaction
This API method sends a WIN copied transaction to the operator immediately after receiving the transaction from the streamer during an active game round.
POST
Headers
Request
Field | Type | Require | Description |
sessionId | String | mandatory | Unique session identifier |
roundId | String | mandatory | Unique round identifier representing one copy cycle (some number of game actions) |
transactionId | String | mandatory | Unique CopyStake transaction identifier |
transactionIdOriginal | String | mandatory | Original transaction identifier (the streamer's transaction) |
currency | String | mandatory | User's active currency (ISO 4217) |
amount | Double | mandatory | Amount, rounded to 8 decimal places, representing the "copied" action's amount to interact with the user's balance on the operator side |
Response
Field | Type | Require | Description |
balance | Double | mandatory | Current available user's balance, rounded to 8 decimal places |
currency | String | mandatory | User's active currency (ISO 4217) |
Response example
Send ROLLBACK BET copied transaction
This API method sends a ROLLBACK BET copied transaction to the operator immediately after receiving the transaction from the streamer during an active game round.
POST
Headers
Request
Field | Type | Require | Description |
sessionId | String | mandatory | Unique session identifier |
roundId | String | mandatory | Unique round identifier representing one copy cycle (some number of game actions) |
transactionId | String | mandatory | Unique CopyStake transaction identifier |
referenceTransactionId | String | mandatory | Reference to BET CopyStake transaction identifier |
transactionIdOriginal | String | mandatory | Original transaction identifier (the streamer's transaction) |
referenceTransactionIdOriginal | String | mandatory | Reference to original BET transaction identifier |
currency | String | mandatory | User's active currency (ISO 4217) |
amount | Double | mandatory | Amount, rounded to 8 decimal places, representing the "copied" action's amount to interact with the user's balance on the operator side |
Response
Field | Type | Require | Description |
balance | Double | mandatory | Current available user's balance, rounded to 8 decimal places |
currency | String | mandatory | User's active currency (ISO 4217) |
Response example
Send ROLLBACK WIN copied transaction
This API method sends a ROLLBACK WIN copied transaction to the operator immediately after receiving the transaction from the streamer during an active game round.
POST
Headers
Request
Field | Type | Require | Description |
sessionId | String | mandatory | Unique session identifier |
roundId | String | mandatory | Unique round identifier representing one copy cycle (some number of game actions) |
transactionId | String | mandatory | Unique CopyStake transaction identifier |
referenceTransactionId | String | mandatory | Reference to BET CopyStake transaction identifier |
transactionIdOriginal | String | mandatory | Original transaction identifier (the streamer's transaction) |
referenceTransactionIdOriginal | String | mandatory | Reference to original BET transaction identifier |
currency | String | mandatory | User's active currency (ISO 4217) |
amount | Double | mandatory | Amount, rounded to 8 decimal places, representing the "copied" action's amount to interact with the user's balance on the operator side |
Response
Field | Type | Require | Description |
balance | Double | mandatory | Current available user's balance, rounded to 8 decimal places |
currency | String | mandatory | User's active currency (ISO 4217) |
Response example
Error handling and retry mechanism
CopyStake is very sensitive to the stability and speed of the operator's response and cannot allow long delays in response or a classic retry mechanism with several attempts. In the case of prolonged latency, CopyStack will interrupt the game round but keep the session active. If an error differs from those below, there will be one retry attempt.
Response
Field | Type | Require | Description |
errorCode | String | mandatory | ERR_UNKNOWN General error status, for cases without a special error code. ERR_INSUFFICIENT_FUNDS Not enough money on the user's balance to process a transaction ERR_DUPLICATE_TRANSACTION A transaction with the same identifier was sent ERR_USER_DISABLED User is disabled/locked (cannot interact with user's balance) ERR_INVALID_SIGNATURE Operator couldn't verify the signature on request from |
errorMessage | String | optional | more detailed description of the error |
Response example
Last updated