Your TopUp business partner! A comprehensive TypeScript library for managing orders, stocks, users, nodes, and more.
Install the package using your preferred package manager:
npm install topupapi
# or
pnpm add topupapi
import { TopUpClient } from 'topupapi';
const client = new TopUpClient({
token: 'YOUR_API_TOKEN'
});
- Order Management: Place orders, track their status, and manage order combinations.
- Stock Management: Handle inventory with options for adding, buying, and refunding stocks.
- User Management: Manage users and merchants with advanced permission settings.
- Node & Shard Management: Configure and monitor nodes and shards for efficient system operation.
Create orders with game details, amount, and callback URLs.
const order = await client.order.place({
game: "GAME", // 'FREE_FIRE' | 'FREE_FIRE_SHELL' | 'FREE_FIRE_SG' | 'FREE_FIRE_ID
amount: "100", // Diamond amount
uid: "PLAYER_UID",
callbackUrl: "https://your-callback-url.com",
quantity: 1 // optional
});
Endpoint: POST /order/
Retrieve orders with filtering and pagination options.
// Get all orders
const allOrders = await client.order.fetch();
// Get a specific order
const order = await client.order.fetch("ORDER_ID");
// Get paginated orders
const paginatedOrders = await client.order.fetch({
offset: 0,
limit: 10
});
Endpoints:
GET /order/orders
GET /order/:orderId
GET /order?offset=0&limit=10
Track the status of an order.
const status = await client.order.status({ orderId: "ORDER_ID" });
Endpoint: GET /order/status/:orderId
Calculate possible combinations for specified order amounts.
const combinations = await client.order.combinationBreaker({
amount: "100",
game: "GAME", // 'FREE_FIRE' | 'FREE_FIRE_SHELL' | 'FREE_FIRE_SG' | 'FREE_FIRE_ID
});
Endpoint: POST /order/combination-breaker
Add new stock items to your inventory.
const newStock = await client.stocks.add({
game: "GAME", // 'FREE_FIRE' | 'FREE_FIRE_SHELL' | 'FREE_FIRE_SG' | 'FREE_FIRE_ID
codeTxt: "YOUR_CODE_TEXT",
amount: 100,
price: "10000"
});
Endpoint: POST /stock/add
Purchase stock with specified combinations and quantities.
const purchase = await client.stocks.buy({
game: "GAME", // 'FREE_FIRE' | 'FREE_FIRE_SHELL' | 'FREE_FIRE_SG' | 'FREE_FIRE_ID
combination: [100, 200],
quantity: 1
});
Endpoint: POST /stock/buy
Process refunds for purchased stocks.
const refund = await client.stocks.refund({
game: "GAME", // 'FREE_FIRE' | 'FREE_FIRE_SHELL' | 'FREE_FIRE_SG' | 'FREE_FIRE_ID
checkCode: ["CODE_1", "CODE_2"]
});
Endpoint: PATCH /stock/refund
Add a new user to the platform.
const user = await client.users.register({
name: "John Doe"
});
Endpoint: POST /user/register
Add merchants and configure their profit rates.
const merchant = await client.users.addMerchant({
userId: 123,
profitRate: 0.15
});
Endpoint: POST /user/merchant
Update merchant configurations.
const updated = await client.users.updateMerchant({
userId: 123,
profitRate: 0.20
});
Endpoint: PATCH /user/merchant
Add and manage nodes in your network.
const node = await client.nodes.add({
endPoint: "192.168.1.1",
connectionToken: "YOUR_CONNECTION_TOKEN"
});
Endpoints:
POST /node/add
GET /node/
Configure and monitor shard behavior.
const updatedConfig = await client.nodes.updateShardConfig({
flowGate: true,
flowGateMode: "LIMIT",
flowGateLimit: 1000
});
Endpoints:
GET /node/shards/config
PATCH /node/shards/config
The library provides strongly typed responses for all operations:
- Orders:
Order
,OrderStatus
,OrderState
- Stocks:
StockAddResponse
,StockBuyResponse
,StockRefundResponse
- Users:
User
,Merchant
- Nodes:
Node
,ShardConfigDto
Refer to the types documentation for detailed schemas.
Check the Changelog for version details and updates.
This project is licensed under the MIT License.
For more details and documentation, visit T4B.Top.