The Wallet System API is a robust and secure financial transactions management system. It provides a set of endpoints to create and manage user wallets, process credit and debit transactions, handle webhooks, and ensure the integrity and security of financial operations.
Start the database:
docker compose up --force-recreate -d
Install Bun
curl -fsSL https://bun.sh/install | bash
To install dependencies:
bun install
To run:
bun run dev
Endpoint: POST /api/auth/register/
Registers a new user.
Request:
{
"email": "mail@mail.com",
"password": "123456"
}
Response:
{
"tokens": {
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}
Endpoint: POST /api/auth/login/
Logs in a user.
Request:
{
"email": "mail@mail.com",
"password": "123456-"
}
Response:
{
"tokens": {
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}
Endpoint: POST /api/auth/refresh-token/
Refreshes the access token.
Request:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Response:
{
"tokens": {
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}
Endpoint: POST /api/wallet/
Creates a new wallet.
Request:
{
"passphrase": "buttercup"
}
Response:
{
"id": "0461a08e-2ab4-49de-8f84-175be316534f",
"createdAt": "2024-01-17T07:03:08.781Z",
"updatedAt": "2024-01-17T07:03:08.781Z",
"userId": "c2635150-2bb2-4e9e-b5b1-ba951fe2d49f",
"address": "04F311E2D6"
}
Endpoint: GET /api/wallet/
Retrieves wallet information.
Response:
{
"id": "0461a08e-2ab4-49de-8f84-175be316534f",
"createdAt": "2024-01-17T07:03:08.781Z",
"updatedAt": "2024-01-17T07:13:24.663Z",
"userId": "c2635150-2bb2-4e9e-b5b1-ba951fe2d49f",
"address": "04F311E2D6",
"balance": 2000
}
Endpoint: PATCH /api/wallet/
Updates wallet information.
Request:
{
"passphrase": "something-nice"
}
Response:
{
"id": "0461a08e-2ab4-49de-8f84-175be316534f",
"createdAt": "2024-01-17T07:03:08.781Z",
"updatedAt": "2024-01-17T07:13:24.663Z",
"userId": "c2635150-2bb2-4e9e-b5b1-ba951fe2d49f",
"address": "04F311E2D6"
}
Endpoint: DELETE /api/wallet/
Deletes the user's wallet.
Endpoint: POST /api/wallet/deposit/
Deposits funds into the wallet.
Request:
{
"amount": 100
}
Response:
{
"balance": 2100
}
Endpoint: POST /api/wallet/withdraw/
Withdraws funds from the wallet.
Request:
{
"amount": 300,
"passphrase": "something-nice"
}
Response:
{
"balance": 1500
}
This documentation provides a comprehensive guide on using the Wallet System API. For more details on each endpoint, refer to the respective sections.