Skip to content

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 NameDescriptionPath
Common InterfacesCommon interfaces provided by 2J
User DepositUser deposit/open2j/w/transfer/deposit
User WithdrawalUser withdrawal/open2j/w/transfer/withdraw
Query User BalanceQuery user balance/open2j/w/transfer/balance
User Transfer RecordsUser 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:

json
{
  "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
}
ParameterTypeDescriptionRequiredValue Range
op_idstringUser unique identifierYes
amountintDeposit amountYes> 0
trans_nostringTransaction unique identifier, used to prevent duplicate deposits [required]YesMin length: 6, Max length: 64

Response Body:

json
{
    "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:

json
{
  "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
}
ParameterTypeDescriptionRequiredValue Range
op_idstringUser unique identifierYes
amountintWithdrawal amountYes> 0
trans_nostringTransaction unique identifier, used to prevent duplicate withdrawals [required]YesMin length: 6, Max length: 64

Response Body:

freeze_amount means locked part since the user playing a game.

json
{
    "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:

json
{
  "op_id": "string"          // User unique identifier
}
ParameterTypeDescriptionRequiredValue Range
op_idstringUser unique identifierYes

Response Body:

json
{
    "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:

json
{
  "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
}
ParameterTypeDescriptionRequiredValue Range
op_idstringUser unique identifierYes
next_idintNext page parameter. Pass 0 for first request, then pass next_id from previous responseYes
page_sizeintItems per pageNo10-100
created_atinttimestamp seconds, query records before this time (UTC+0)No
trans_nostringTransaction unique identifierNo

Response Body:

json
{
    "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 the trans_no provided by OP, it is not exactly the same as the trans_no provided by OP.

2J Game Inc.