Transfer Wallet Mode
In this mode, OP needs to call 2J's interfaces to perform deposits and withdrawals for player accounts, and OP can query player account balances by calling 2J's interfaces.
See Flow Overview for interaction flow.
Interfaces Provided by 2J
2J provides these interfaces for OP to implement player account deposits, withdrawals, balance queries, and other operations.
Interface Name | Description | Path |
---|---|---|
Common Interfaces | Common interfaces provided by 2J | |
User Deposit | User deposit | /open2j/w/transfer/deposit |
User Withdrawal | User withdrawal | /open2j/w/transfer/withdraw |
Query User Balance | Query user balance | /open2j/w/transfer/balance |
User Transfer Records | User transfer records | /open2j/w/transfer/records |
1. User Deposit /open2j/w/transfer/deposit
/open2j/w/transfer/deposit
is renamed from/open/tansfer/deposit
, please update your code.
Method: POST
URI: /open2j/w/transfer/deposit
Description: User deposit. This interface is rate-limited to 5000 requests per 10 seconds.
Request Body:
{
"op_id": "string", // User unique identifier
"amount": 1000, // Deposit amount, in li units
"trans_no": "string" // Transaction unique identifier, used to prevent duplicate deposits [required] Min length: 6, Max length: 64
}
Parameter | Type | Description | Required | Value Range |
---|---|---|---|---|
op_id | string | User unique identifier | Yes | |
amount | int | Deposit amount | Yes | > 0 |
trans_no | string | Transaction unique identifier, used to prevent duplicate deposits [required] | Yes | Min length: 6, Max length: 64 |
Response Body:
{
"header": {
"code": 0, // Error code, 0 means normal, non-0 means abnormal
"msg": "string", // Error message
"timestamp": 1709716095516
},
"result": {
"balance": 2000 // Balance after deposit
}
}
2. User Withdrawal /open2j/w/transfer/withdraw
/open2j/w/transfer/withdraw
is renamed from/open/tansfer/withdraw
, please update your code.
Method: POST
URI: /open2j/w/transfer/withdraw
Description: User withdrawal. This interface is rate-limited to 5000 requests per 10 seconds.
Request Body:
{
"op_id": "string", // User unique identifier
"amount": 1000, // Withdrawal amount
"trans_no": "string" // Transaction unique identifier, used to prevent duplicate withdrawals [required] Min length: 6, Max length: 64
}
Parameter | Type | Description | Required | Value Range |
---|---|---|---|---|
op_id | string | User unique identifier | Yes | |
amount | int | Withdrawal amount | Yes | > 0 |
trans_no | string | Transaction unique identifier, used to prevent duplicate withdrawals [required] | Yes | Min length: 6, Max length: 64 |
Response Body:
freeze_amount
means locked part since the user playing a game.
{
"header": {
"code": 0, // Error code, 0 means normal, non-0 means abnormal
"msg": "string", // Error message
"timestamp": 1709716095516
},
"result": {
"balance": 2000, // Balance after withdrawal
"freeze_amount": 1, // Frozen amount in balance those couldn't withdraw
}
}
3. Query User Balance /open2j/w/transfer/balance
/open2j/w/transfer/balance
is renamed from/open/tansfer/balance
, please update your code.
Method: POST
URI: /open2j/w/transfer/balance
Description: Query user balance. This interface is rate-limited to 5000 requests per 10 seconds.
Request Body:
{
"op_id": "string" // User unique identifier
}
Parameter | Type | Description | Required | Value Range |
---|---|---|---|---|
op_id | string | User unique identifier | Yes |
Response Body:
{
"header": {
"code": 0, // Error code, 0 means normal, non-0 means abnormal
"msg": "string", // Error message
"timestamp": 1709716095516
},
"result": {
"balance": 1000 // User balance
}
}
4. User Transfer Records /open2j/w/transfer/records
/open2j/w/transfer/records
is renamed from/open/tansfer/records
, please update your code.
Method: POST
URI: /open2j/w/transfer/records
Description: User transfer records, sorted by time in descending order by default; this interface is rate-limited to 5000 requests per 10 seconds.
Request Body:
{
"op_id": "string", // User unique identifier
"next_id": 1709716095516, // Next page parameter
"page_size": 10, // Items per page, default 10, maximum 100
"created_at": 1737009390, // Query records before this time
"trans_no": "string" // Transaction unique identifier
}
Parameter | Type | Description | Required | Value Range |
---|---|---|---|---|
op_id | string | User unique identifier | Yes | |
next_id | int | Next page parameter. Pass 0 for first request, then pass next_id from previous response | Yes | |
page_size | int | Items per page | No | 10-100 |
created_at | int | timestamp seconds, query records before this time (UTC+0) | No | |
trans_no | string | Transaction unique identifier | No |
Response Body:
{
"header": {
"code": 0, // Error code, 0 means normal, non-0 means abnormal
"msg": "string", // Error message
"timestamp": 1709716095516
},
"result": {
"next_id": 1709716095516,// Parameter needed for next page, 0 means no more pages
"records": [
{
"id": 1709716095515, // ID
"type": 3, // Record type 4: deposit 3: withdrawal
"amount": 1000, // Amount
"after_balance": 2000, // Balance (after change)
"ref_id": "string", // Unique order number
"trans_no": "string", // Unique order number assembled by 2J based on OP's trans_no
"created_at": 1737009390 // Creation time UTC timestamp
}
]
}
}
Note: The
trans_no
in the response is a unique order number assembled by 2J based on thetrans_no
provided by OP, it is not exactly the same as thetrans_no
provided by OP.