Skip to main content
Credit Debit
curl --request POST \
  --url https://ss.game-services.work/credit-debit \
  --header 'Authorization: Bearer <token>'
POST /credit-debit
Content-Type: application/json
{
    "playerId": "123e4567-e89b-12d3-a456-426614174000",
    "creditAmount": 20.00,
    "debitAmount": 0.00,
    "gameUuid": "b23e45a7-9be8-d312-56a4-174000426614",
    "sessionId": "1c4f1d6d-5e37-4a8f-e642-def88a3b4749",
    "roundId": "nAanFguGKTnLMlaPtIb2MZgnpY-IzB6x94qd5refwyIjGZWJl0mHs00tM2mPHWpvLN7IE3KH6QOR",
    "transactionId": "DER6i2rKbzn6S1qzb38fKBZZ3oehgO0Um7MyYhsFcXSW1kfxw-02_bS4WNzQb0hhBU2NqqkUch-y5KyKv2fdsf4",
    "transactionType": "CREDIT_DEBIT_SPIN",
    "transactionTimestamp": 1632771475000,
    "roundStarted": true,
    "roundFinished": false,
    "currency": "USD",
}

POST /credit-debit
This operation is idempotent.

Headers

NameTypeDescription
X-Auth-TokenstringCustom authentication header in the format X-Auth-Token: your_token_here. This token is required to authorize API requests.

Request Parameters

NameTypeDescription
playerIdstringUnique identifier of the player.
creditAmountdecimalAmount to credit.
debitAmountdecimalAmount to debit.
gameUuidstringUnique identifier of the game.
sessionIdstringUnique identifier of the player session.
roundIdstringUnique identifier of the game round.
transactionIdstringUnique identifier of the game round transaction.
transactionTypestringType of transaction, e.g., ‘CREDIT_DEBIT_SPIN’.
transactionTimestampintegerTimestamp of the transaction in milliseconds.
roundStartedbooleanFlag indicating start of the round.
roundFinishedbooleanFlag indicating end of the round.
currencystringCurrency code of the player.
Transaction Types: Enum representing the type of transaction.
  • CREDIT_DEBIT_SPIN: A regular spin-based transaction.
  • CREDIT_DEBIT_PURCHASE: A transaction where the player directly purchases a bonus feature within the game.

Response Parameters

NameTypeDescription
balancedecimalThe updated balance of the player.

Error

If an error occurs while processing a request, the API must return a response with HTTP Status Code: 400 Bad Request
NameTypeDescription
error_codestringError code describing the specific issue.

Responsibility of the wallet platform
The wallet platform must verify that the incoming sessionId is valid and correctly associated with the provided playerId. The wallet platform should ensure that creditAmount is not less than the player’s balance before transaction. INSUFFICIENT_FUNDS error should be returned otherwise. In addition, it should persist roundId, playerId, transactionId and amount to ensure that future debit or rollback operations can be reliably processed, maintaining the integrity of the player’s balance throughout the game session.
POST /credit-debit
Content-Type: application/json
{
    "playerId": "123e4567-e89b-12d3-a456-426614174000",
    "creditAmount": 20.00,
    "debitAmount": 0.00,
    "gameUuid": "b23e45a7-9be8-d312-56a4-174000426614",
    "sessionId": "1c4f1d6d-5e37-4a8f-e642-def88a3b4749",
    "roundId": "nAanFguGKTnLMlaPtIb2MZgnpY-IzB6x94qd5refwyIjGZWJl0mHs00tM2mPHWpvLN7IE3KH6QOR",
    "transactionId": "DER6i2rKbzn6S1qzb38fKBZZ3oehgO0Um7MyYhsFcXSW1kfxw-02_bS4WNzQb0hhBU2NqqkUch-y5KyKv2fdsf4",
    "transactionType": "CREDIT_DEBIT_SPIN",
    "transactionTimestamp": 1632771475000,
    "roundStarted": true,
    "roundFinished": false,
    "currency": "USD",
}

I