Buy Stocks

Buy Stocks from the User Account using atomic Redis operations. This endpoint uses Redis Sorted Sets with Lua scripts to perform atomic checkout operations. The process uses the key pattern `stock:${ownerId}:${game}:${groupId}` to locate and remove stock IDs. The operation is fully atomic - either all requested stock is acquired or none is taken. After successful Redis checkout, the corresponding PostgreSQL records are updated.

POST
/stock/buy
/stock/buy

The Authorization access token

Authorization

Authorization
Required
Bearer <token>

In: header

Request Body

application/jsonRequired

game
Required
string

Game type to buy

Value in: "FREE_FIRE" | "FREE_FIRE_SHELL" | "FREE_FIRE_SG" | "FREE_FIRE_ID"

combination
Required
array<number>

Array of combination numbers

quantitynumber

Quantity to buy

curl -X POST "https://api.t4b.top/stock/buy" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "game": "FREE_FIRE",
    "combination": [
      1,
      2,
      3
    ],
    "quantity": 1
  }'

Ok

{
  "data": {
    "schema": {
      "available": true,
      "quantity": 0,
      "codes": [
        {
          "code": {
            "amount": 0,
            "serial": "string"
          },
          "codeType": "string",
          "game": "string"
        }
      ]
    }
  },
  "statusCode": 200
}