API Portal

πŸ’° Credits Action Endpoint

The Credits Action API allows a cashier to add or remove credits from a player account. Depending on whether the amount is positive or negative, the system performs a cash in or cash out operation respectively.

⚠️ Handling bonus_error, wager issues, and Reset Behavior

Most errors in this endpoint are related to wager mode (wager = 1). These checks exist to protect game integrity when a player has unfinished rounds, active bonuses, or temporary restrictions.

If you do not use wager = 1, most of these errors will never appear.


πŸ” Common Error Cases
πŸ” Credits IN

1️⃣ 409 Conflict β€” Player already has active credits

{
  "success": false,
  "message": "Player has credits, first play all credits"
}

πŸ’‘ This means the player still has active game credits. You must first perform a CASH OUT before doing another CASH IN. Resetting will not help β€” simply finish or withdraw existing credits.

2️⃣ 423 Locked β€” Player in cooldown (Wager protection)

πŸ” Credits IN
{
  "success": false,
  "message": "You cannot use Wager Bonus yet. Try again in 0:22:41. player: p100"
}

πŸ’‘ The player is still under a wager timer and cannot use bonus mode yet. Wait until the countdown ends or perform a CASH IN with wager = false.
Reset will not fix this issue.

3️⃣ 423 Locked β€” Unfinished session (Bonus error)

πŸ” Credits IN | OUT
{
  "success": false,
  "desc": "bonus_error",
  "message": "Player: p100. Error: Total win not collected, please collect. Game: Black Jack"
}

πŸ’‘ This appears when the player has unfinished bonuses, free spins, or total wins. In this case, you may safely retry the request with reset: true to automatically clear all active bonus or session data.


πŸ‘‰ Use reset: true only when you receive a bonus_error. For all other errors (like active credits or wager timer), reset will not help.

Summary:
- πŸ”Ή wager = 1 β†’ enables stricter validation (may trigger 409 or 423).
- πŸ”Ή wager = false β†’ simpler cash in/out, fewer restrictions.
- πŸ”Ή reset = true β†’ use only for bonus_error cases.
ℹ️ Description
  • Positive amount β†’ Credits IN (Deposit / Wager).
  • Negative amount β†’ Credits OUT (Withdraw / Cash Out).
  • The action automatically updates player, cashier, and shop balances.
  • Bonuses, wager limits, and happy hour logic are handled automatically by the backend.
  • Wager mode (wager = 1): Performs strict checks to prevent overlapping sessions or unfinished games.
  • Reset flag (reset = true): Automatically clears unfinished player sessions before applying IN/OUT. Only needed when the API returns a bonus_error.
Endpoint
POST https://proapi.gapi.lol/api/cashier/user/{id}/credits-action
Authentication

This endpoint requires a valid cashier Bearer token:

Authorization: Bearer <your_token>
Accept: application/json
Request Body

Send the following fields as JSON in the request body:

{
  "amount": 100,
  "wager": 1,
  "reset": false
}
  • 100 = 1.00 USD
  • Wager player gets double credits with cashout restrictions
  • amount β€” credits to add (positive) or remove (negative).
  • wager β€” optional flag (1 = enable wager bonus mode).
  • reset β€” optional flag (true = reset unfinished bonuses/sessions).
Successful Response

When credits are added successfully:

{
  "success": true,
  "in": true,
  "message": "demo in: Normal deposit: 100.00 USD"
}

When credits are withdrawn successfully:

{
  "success": true,
  "out": true,
  "message": "demo out: 50.00 USD"
}
Error Responses

400 Bad Request β€” Invalid or missing amount:

{
  "success": false,
  "message": "Invalid amount"
}

401 Unauthorized β€” Invalid or missing token:

{
  "success": false,
  "message": "Unauthorized"
}

404 Not Found β€” Player not found:

{
  "success": false,
  "message": "User not found"
}

403 Forbidden β€” Insufficient shop credits:

{
  "success": false,
  "message": "You dont have enough credits, please contact your operator!"
}

409 Conflict β€” Player already has active credits:

{
  "success": false,
  "message": "Player has credits, first play all credits"
}

πŸ’‘ When you see this message, you must first perform a CASH OUT before doing another CASH IN.

423 Locked β€” Player in cooldown (Wager protection):

{
  "success": false,
  "message": "You cannot use Wager Bonus yet. Try again in 0:22:41. player: p100"
}

πŸ’‘ Wait until the timer expires, or perform a CASH IN with wager = false.

423 Locked β€” Unfinished session (Bonus error):

{
  "success": false,
  "desc": "bonus_error",
  "message": "Player: p100. Error: Total win not collected, please collect. Game: Black Jack"
}

πŸ’‘ Only in this case you may safely retry with reset = true.

500 Internal Server Error β€” Unexpected issue:

{
  "success": false,
  "message": "Server error: Database transaction failed"
}
Example Request (cURL)
curl -X POST "https://proapi.gapi.lol/api/cashier/user/3154/credits-action" \
  -H "Authorization: Bearer <your_token>" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 100,
    "wager": 1,
    "reset": true
  }'