Single Wallet API Integration | Spinfinity777
Single Wallet Integration Guide
Revision History
| Date | Version | Editor | Change Log |
| --- | --- | --- | --- |
| 2024/09/10 | 1.1.5 | S7-02 | Added kick-out player and game detail query. |
| 2024/09/02 | 1.1.2 | S7-02 | Unified URL style, added token parameters and error code appendix. |
| 2024/08/31 | 1.1.1 | S7-02 | Added S7 test environment domain, removed redundant login fields, added language and currency codes. |
| 2024/08/20 | 1.0.3 | S7-02 | Complete initial version. |
Introduction
This document describes the single wallet integration mode for Spinfinity777.
In single wallet mode, player balance is maintained by the operator. Spinfinity777 calls the operator API in real time for balance queries and bet settlement.
Test environment:
Main domain: https://www.spinfinity777.com/h5
Game list endpoint: https://www.spinfinity777.com/h5/external/game-list
1. Preparation
1.1 Required Operator Information
- Operator name or code.
- Operator server IP whitelist.
1.2 Credentials
Spinfinity777 provides the following after review:
- `app_id`: unique operator identifier.
- `app_key`: API signing key.
- `password`: operator backend login password.
- `api_url`: API base URL.
Keep all credentials confidential.
2. API Rules
- Field naming: snake_case.
- Protocol: HTTPS.
- Method: GET or POST.
- POST format: form key-value parameters.
- GET format: query string.
- Every request must include `time` and `non_str`.
- Response format: JSON.
Success example:
{
"code": 0,
"msg": "ok",
"data": {}
}
3. Signature Algorithm
1. Sort all request parameters except `sign` by ASCII order of key. 2. Join as `key=value` pairs with `&`. 3. Append `&app_key={app_key}`. 4. Calculate lowercase MD5. The result is the `sign`.
Example:
app_id=10000&non_str=jk7545s&time=1536635343&app_key=64189fd2b30ce1c93fc2b035d2e3bc5e
4. Operator APIs Required by Single Wallet Mode
The operator must provide the following APIs. Spinfinity777 calls these APIs during gameplay.
4.1 Query Player Balance
- API URL: `ApiDomain/cash/balance`
- Method: POST
- Description: Spinfinity777 queries the player wallet balance in real time. The operator should respond within 10 seconds.
Request parameters:
| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| time | int | Yes | Unix timestamp in seconds. |
| non_str | string | Yes | Random string. |
| sign | string | Yes | Signature. |
| app_id | string | Yes | Operator app ID. |
| trace_id | string | Yes | Unique request ID. |
| open_id | String | Yes | Unique player account ID. |
| token | String | Yes | Player token passed when entering Spinfinity777. |
| platform_data | String | Yes | Operator platform data passed when entering Spinfinity777. |
| updated_time | int | Yes | Unix millisecond timestamp. |
Response parameters:
| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| time | int | Yes | Unix timestamp in seconds. |
| non_str | string | Yes | Random string. |
| sign | string | Yes | Signature. |
| app_id | string | Yes | Operator app ID. |
| open_id | String | Yes | Unique player account ID. |
| currency_code | string | Yes | Player currency. |
| balance_amount | string | Yes | Current player balance, maximum two decimals. |
| token | String | Yes | Refreshed token. Empty if not refreshed. |
| updated_time | int | Yes | Return the same `updated_time` from request. |
Error codes:
| Code | Message |
| --- | --- |
| 1018 | Wallet does not exist |
| 1022 | Token expired |
| 1099 | Other error |
4.2 Bet and Payout
- API URL: `ApiDomain/cash/transfer-in-out`
- Method: POST
- Description: sends one bet settlement to the operator. The request includes both bet amount and win amount.
Balance formula:
If balance before bet >= betAmount:
balance after bet = balance before bet - betAmount + winAmount
Else:
reject the bet
Request parameters:
| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| time | Long | Yes | Unix timestamp in seconds. |
| non_str | string | Yes | Random string. |
| sign | string | Yes | Signature. |
| app_id | string | Yes | Operator app ID. |
| trace_id | string | Yes | Unique request ID. |
| open_id | String | Yes | Unique player account ID. |
| token | String | Yes | Player token. |
| platform_data | String | Yes | Operator platform data. |
| game_id | int | Yes | Game ID from game list API. |
| parent_bet_id | string | Yes | Parent bet ID. |
| bet_id | string | Yes | Child bet ID. |
| currency_code | string | Yes | Player currency. |
| bet_amount | string | Yes | Bet amount. |
| win_amount | string | Yes | Win amount. |
| transaction_id | string | Yes | Unique transaction ID. |
| create_time | long | Yes | Bet update time in milliseconds. |
| updated_time | long | Yes | Settlement update time in milliseconds. |
| bet_type | int | No | Bet type. |
| game_type | int | No | Game type. |
| is_retry_failed | boolean | No | Whether this is a retry of a failed transaction. |
Response parameters:
| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| time | int | Yes | Unix timestamp in seconds. |
| non_str | string | Yes | Random string. |
| sign | string | Yes | Signature. |
| app_id | string | Yes | Operator app ID. |
| open_id | string | Yes | Unique player account ID. |
| currency_code | string | Yes | Player currency. |
| balance_amount | string | Yes | Player balance after settlement. |
| token | String | Yes | Refreshed token. Empty if not refreshed. |
| updated_time | int | Yes | Return request `updated_time`. |
Error codes:
| Code | Message |
| --- | --- |
| 1018 | Wallet does not exist |
| 1019 | Bet does not exist |
| 1020 | Bet failed |
| 1021 | Insufficient balance |
| 1022 | Token expired |
| 1099 | Other error |
4.3 Kick Out Player
The operator may request Spinfinity777 to kick out a player when the account status changes, token expires, or the player logs in elsewhere.
4.4 Game Detail Query
The operator can query game detail information for display, launch preparation, or platform synchronization.
5. Integration Notes
- The operator API must be highly available.
- Return responses within the agreed timeout.
- Use idempotency for `trace_id`, `bet_id`, and `transaction_id`.
- Never expose `app_key` on the frontend.
- Keep server time synchronized.