Wallet and payments
Player balance, top-up through YooKassa and YooKassa notifications.
Player wallet #
/v1/walletAccess: Player token Header Authorization: Bearer <player token> — issued by SMS sign-in.
Balance in roubles and the last 30 operations: top-ups, bookings, refunds, rentals, shares.
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | string | yes | Bearer <player token> |
Example request
curl -X GET "https://your-server/api/v1/wallet" \
-H "Authorization: Bearer <player token>"Responses
| Code | detail | Meaning |
|---|---|---|
| 200 | — | Success; example below |
| 401 | no_token | No token in the Authorization header |
| 401 | invalid_token | Token expired or invalid — refresh it via /v1/auth/refresh |
Example response
{
"balance": 4200,
"transactions": [
{
"id": "71b3e9d0-5c2a-4e86-9f14-a8d6c3b0e275",
"amount": 5000,
"kind": "topup",
"status": "done",
"note": "YooKassa payment 2f1a…",
"at": "2026-10-02T09:12:44+00:00"
}
]
}Top up the wallet #
/v1/wallet/topupAccess: Player token Header Authorization: Bearer <player token> — issued by SMS sign-in.
Creates a YooKassa payment and returns confirmationUrl — the payment page to open for the player. Money is credited only after the status is confirmed with YooKassa. The amount is whole roubles within the cloud limits (100–100,000 by default). If online payment is not connected — 503.
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | string | yes | Bearer <player token> |
Request body application/json
| Field | Type | Required | Description |
|---|---|---|---|
amount | integer | yes | Amount in whole roubles greater than 0; max 100000 |
Example request
curl -X POST "https://your-server/api/v1/wallet/topup" \
-H "Authorization: Bearer <player token>" \
-H "Content-Type: application/json" \
-d '{"amount": 5000}'Responses
| Code | detail | Meaning |
|---|---|---|
| 200 | — | Success; example below |
| 401 | no_token | No token in the Authorization header |
| 401 | invalid_token | Token expired or invalid — refresh it via /v1/auth/refresh |
| 400 | bad_amount | Amount out of range; min and max are returned |
| 503 | payments_provider_not_configured | Online payment is not connected |
| 502 | payment_create_failed | YooKassa did not create the payment |
| 422 | […] | Parameter or body validation error: detail is a list of errors |
Example response
{
"ok": true,
"status": "pending",
"paymentId": "e4a19c7d-6b3f-4c21-8d5e-0f2a7b9c1d36",
"confirmationUrl": "https://yoomoney.ru/checkout/payments/v2/contract?orderId=<id>"
}Top-up payment status #
/v1/wallet/payments/{payment_id}Access: Player token Header Authorization: Bearer <player token> — issued by SMS sign-in.
Top-up status after returning from the payment page. If the payment is still pending, the cloud re-requests the status from YooKassa and credits the money on success. Statuses: pending, succeeded, canceled.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
payment_id | string (uuid) | yes | paymentId from the top-up response |
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | string | yes | Bearer <player token> |
Example request
curl -X GET "https://your-server/api/v1/wallet/payments/e4a19c7d-6b3f-4c21-8d5e-0f2a7b9c1d36" \
-H "Authorization: Bearer <player token>"Responses
| Code | detail | Meaning |
|---|---|---|
| 200 | — | Success; example below |
| 401 | no_token | No token in the Authorization header |
| 401 | invalid_token | Token expired or invalid — refresh it via /v1/auth/refresh |
| 404 | payment_not_found | Payment not found or not yours |
| 422 | […] | Parameter or body validation error: detail is a list of errors |
Example response
{
"paymentId": "e4a19c7d-6b3f-4c21-8d5e-0f2a7b9c1d36",
"status": "succeeded",
"amount": 5000,
"balance": 9200
}YooKassa notification #
/v1/wallet/yookassa/webhookAccess: YooKassa only No authorization: the notification body is not trusted, the payment status is re-requested from YooKassa.
The YooKassa notification endpoint. Only object.id is taken from the body; the status and amount are re-requested from YooKassa with the shop key and checked against the cloud record. Money is credited exactly once, repeated notifications change nothing. An unknown payment — 200 with ignored=true.
Request body
Body — the YooKassa notification object; the cloud reads only object.id from it.
Example request
curl -X POST "https://your-server/api/v1/wallet/yookassa/webhook" \
-H "Content-Type: application/json" \
-d '{
"type": "notification",
"event": "payment.succeeded",
"object": {"id": "<YooKassa payment id>", "status": "succeeded"}
}'Responses
| Code | detail | Meaning |
|---|---|---|
| 200 | — | Success; example below |
| 400 | no_payment_id | No object.id in the notification |
| 422 | […] | Parameter or body validation error: detail is a list of errors |
Example response
{"ok": true, "status": "succeeded"}