Skip to content

Latest commit

 

History

History
144 lines (115 loc) · 2.2 KB

File metadata and controls

144 lines (115 loc) · 2.2 KB

Economy API

Endpoint

POST /api/economy

Authentication

All requests require a valid Bearer token in the Authorization header.

Authorization: Bearer YOUR_API_TOKEN

Actions

get_coin — retrieve current balances

Retrieve all balances:

{
  "action": "get_coin",
  "account_type": "player",
  "account_uuid": "player-123"
}

Retrieve specific balance:

{
  "action": "get_coin",
  "account_type": "player",
  "account_uuid": "player-123",
  "coin_type": "GOLD"
}

Response example (All):

{
  "account_type": "player",
  "account_uuid": "player-123",
  "balances": {
    "COIN": "0",
    "COPPER": "0",
    "SILVER": "0",
    "GOLD": "0",
    "POINT": "0"
  }
}

Response example (Specific):

{
  "account_type": "player",
  "account_uuid": "player-123",
  "balances": {
    "GOLD": "0"
  }
}
add_coin — add currency to an account
{
  "action": "add_coin",
  "account_type": "player",
  "account_uuid": "player-123",
  "coin_type": "GOLD",
  "amount": 5
}

Response example:

{
  "message": "Coin added",
  "balance": "5",
  "currency": "GOLD"
}
minus_coin — deduct currency from an account
{
  "action": "minus_coin",
  "account_type": "player",
  "account_uuid": "player-123",
  "coin_type": "GOLD",
  "amount": 2
}

Response example:

{
  "message": "Coin deducted",
  "balance": "3",
  "currency": "GOLD"
}
create_account — verify or create an economy account
{
  "action": "create_account",
  "account_type": "player",
  "account_uuid": "player-123"
}

Response example:

{
  "message": "Account verified/created",
  "account_uuid": "player-123"
}

Notes

  • account_type defaults to player (e.g., player, guild).
  • coin_type values include COIN, COPPER, SILVER, GOLD, and POINT.
  • amount should be a numeric value (handled as BigInt internally).
  • All balances are returned as strings to maintain precision for large numbers.