# Single wallet API doc (Platform to game provider) (v1.7) [TOC] --- ## Encrypt and decrypt ### Verification Connecting method are all post. Body use json format. Encryption AES algorithm, specifically CBC mode, with 256 bits key length and PKCS7 padding. Encrypt whole data-raw iv(base64) + encrypt data-raw(base64) send ### Parameter detail | Parameter | Discription | Remark | |:---------:|:------------------ |:--------------------- | | domain | Website IP Address | Please ask personally | | api_key | Encrypt key | Please ask personally | | version | Version | Please ask personally | | hall | Code | Please ask personally | ### PHP encrypt example // encrypt: function encrypt($string) { $key = base64_decode('MB7j5Nh5GQJsWx6CJS7HEp53YBng0lNZz4u0RHfC83k='); $encryptMethod = "AES-256-CBC"; $iv = openssl_random_pseudo_bytes(16); $output = openssl_encrypt($string, $encryptMethod, $key, OPENSSL_RAW_DATA, $iv); $output = base64_encode($iv) . base64_encode($output); return $output; } // decrypt: function decrypt($string) { $key = base64_decode('MB7j5Nh5GQJsWx6CJS7HEp53YBng0lNZz4u0RHfC83k='); $encryptMethod = "AES-256-CBC"; $iv = base64_decode(substr($string, 0, 24)); $string = substr($string, 24); $output = openssl_decrypt(base64_decode($string), $encryptMethod, $key, OPENSSL_RAW_DATA, $iv); return $output; } ### PHP collect member limit as an example body raw = {"accont":"dome"} encrypt =>8JOV5zqPb/FlIbFPmEWaJA==OtQQX9hfLEht9gX2rt26Q0UlVOWDKlKsLoZKznykuXJLW6E9TLehsTeLBbmUdyLP curl --location --request POST 'http://{{domain}}/balance' \ --header 'Content-Type: text/plain' \ --data-raw '8JOV5zqPb/FlIbFPmEWaJA==OtQQX9hfLEht9gX2rt26Q0UlVOWDKlKsLoZKznykuXJLW6E9TLehsTeLBbmUdyLP' Response as YxR5y6zine+2Ck+yvksbSg==Bk3krlhPmCVymahPJ26dosmJ2uGT6yXq2CJ+lYuB8ryl5Q9HzOFmHReteXx0eZ\/w decrypt => {"Code":XX,"Account":"xx","Balance":"999"} --- ## API ### Encrypt test Request POST body-raw 'str' URL encrypt/{api_key} // encrypt decrypt/{api_key} // decode Response: result ### Player varification Request POST {domain}/{version}/{hall}/user Game party send: | Parameter | Type | Remark | |:--------- |:---- |:--------------------------------------------------------- | | Account | str | Support special symbols "\_" (required) | | Time | int | Unix timestamp seconds when the request was sent (option) | Our response: | Parameter | Discription | Remark | |:---------:|:-------------------------------------------------------- |:------------------------------------------------ | | Code | Success or not | | | Account | Member identification | If Code is not 1, Can be ignored | | Balance | Player balance | If Code is not 1, Can be ignored | | Time | Unix timestamp seconds when our processing was completed | If Time is not null, this value will be returned | Code instruction: | Code | Discription | Remark | |:----:|:----------------- |:------ | | 1 | Success | | | 0 | Undentified error | | ### Collect member balance Request POST {domain}/{version}/{hall}/balance Game party send: | Parameter | Type | Remark | |:---------:|:---- |:--------------------------------------------------------- | | Account | str | (Required) | | Time | int | Unix timestamp seconds when the request was sent (option) | Our response: | Parameter | Discription | Remark | |:---------:|:-------------------------------------------------------- |:------------------------------------------------ | | Code | Success or not | | | Account | Member identification | If Code is not 1, Can be ignored | | Balance | Player balance | If Code is not 1, Can be ignored | | IsLock | Balance lock or not | true or false | | Time | Unix timestamp seconds when our processing was completed | If Time is not null, this value will be returned | Code instruction: | code | Discription | Remark | |:----:|:----------------- |:------ | | 1 | Success | | | 0 | Undentified error | | ### Transfer (Can immediate know payout type, also use to cancel bet sheet and compensate balance) Request POST {domain}/{version}/{hall}/transfer Game party send: | Parameter | Type | Remark | |:----------:|:------------ |:------------------------------------------------------------------------------------------------------------------- | | Account | str | (required) | | Type | str | · add: Add amount<br> · reduce: Reduce amount | | Amount | number(18,2) | Change balance | | BetId | str | Bet ID Unique value (required) | | TransferId | str | Transfer ID unique value (required)<br>Onces resend at internet timeout, please makesure same TransferId at resend | | Time | int | Unix timestamp seconds when the request was sent (option) | P.S. If player lost reduce, if player win, add amount Our response: | Parameter | Discription | Remark | |:----------:|:-------------------------------------------------------- |:------------------------------------------------------------------------------ | | Code | Success or not | | | Account | Member identification | If Code is not 1, Can be ignored | | Balance | Player balance | Balance after calculation<br>If Code is not 1, Can be ignored | | TransferId | Transfer ID unique value (required) | The unique value of the same BetId can be<br> If Code is not 1, Can be ignored | | BetId | Bet ID Unique value (required) | Bet Unique value<br> If Code is not 1, Can be ignored | | Time | Unix timestamp seconds when our processing was completed | If Time is not null, this value will be returned | Type instruction: | Type | Discription | Remark | |:------:|:------------- |:------------- | | add | Add amount | During payout | | reduce | Reduce amount | Betting | Code instruction: | code | Discription | Remark | |:----:|:-------------------- |:------ | | 1 | Success | | | 0 | Undentified error | | | -2 | Insufficient balance | | ### Bet (When can't know the payout result immediately) Request POST {domain}/{version}/{hall}/bet Game party send: | Parameter | Type | Remark | |:----------:|:------------ |:------------------------------------------------------------------------------------------------------------------ | | Account | str | (required) | | TransferId | str | Transfer ID unique value (required)<br>Onces resend at internet timeout, please makesure same TransferId at resend | | BetId | str | Bet ID unique value (required) | | Amount | number(18,2) | Change balance | | Time | int | Unix timestamp seconds when the request was sent (option) | Our response: | Parameter | Discription | Remark | |:----------:|:-------------------------------------------------------- |:------------------------------------------------------------- | | Code | Success or not | | | Account | Member identification | If Code is not 1, Can be ignored | | Balance | Player balance | Balance after calculation<br>If Code is not 1, Can be ignored | | TransferId | Transfer ID unique value (required) | If Code is not 1, Can be ignored | | BetId | Bet ID unique value (required) | If Code is not 1, Can be ignored | | Time | Unix timestamp seconds when our processing was completed | If Time is not null, this value will be returned | Code instruction: | code | Discription | Remark | |:----:|:-------------------- |:------ | | 1 | Success | | | 0 | Undentified error | | | -3 | Insufficient balance | | ### Payout (When can't know the payout result immediately) If payout amount is 0 no need to pay Request POST {domain}/{version}/{hall}/payout Game party send: | Parameter | Type | Remark | |:----------:|:------------ |:------------------------------------------------------------------------------------------------ | | Account | str | (Required) | | TransferId | str | Transfer ID unique value (required)<br>Onces resend at internet timeout, please makesure same TransferId at resend | | BetId | str | Bet ID unique value (required) | | Amount | number(18,2) | Change balance | | Time | int | Unix timestamp seconds when the request was sent (option) | Our response: | Parameter | Discription | Remark | |:----------:|:-------------------------------------------------------- |:------------------------------------------------------------- | | Code | Success or not | | | Account | Member identification | If Code is not 1, Can be ignored | | Balance | Player balance | Balance after calculation<br>If Code is not 1, Can be ignored | | TransferId | Transfer ID unique value (required) | If Code is not 1, Can be ignored | | BetId | Bet ID unique value (required) | If Code is not 1, Can be ignored | | Time | Unix timestamp seconds when our processing was completed | If Time is not null, this value will be returned | Code instruction: | code | Discription | Remark | |:----:|:----------------- |:------ | | 1 | Success | | | 0 | Undentified error | | ### Lock player wallet (optional) Request POST {domain}/{version}/{hall}/auth Game party send: | Parameter | Type | Remark | |:---------:|:---- |:--------------------------------------------------------- | | Account | str | Support special symbols "\_" (required) | | Time | int | Unix timestamp seconds when the request was sent (option) | Our response: | Parameter | Discription | Remark | |:---------:|:-------------------------------------------------------- |:------------------------------------------------ | | Code | Success or not | | | Account | Member identification | If Code is not 1, Can be ignored | | Time | Unix timestamp seconds when our processing was completed | If Time is not null, this value will be returned | Code instruction: | code | Discription | Remark | |:----:|:----------------- |:------ | | 1 | Success | | | 0 | Undentified error | | ### Cancel lock (optional) Request POST {domain}/{version}/{hall}/release Game party send: | Parameter | Type | Remark | |:---------:|:---- |:--------------------------------------------------------- | | Account | str | Support special symbols "\_" (required) | | Time | int | Unix timestamp seconds when the request was sent (option) | Our response: | Parameter | Discription | Remark | |:---------:|:-------------------------------------------------------- |:------------------------------------------------ | | Code | Success or not | | | Account | Member identification | If Code is not 1, Can be ignored | | Time | Unix timestamp seconds when our processing was completed | If Time is not null, this value will be returned | Code instruction: | code | Discription | Remark | |:----:|:----------------- |:------ | | 1 | Success | | | 0 | Undentified error | | ### Error code instruction | code | Discription | Remark | |:----:|:--------------------------- |:---------------------------- | | 0 | Undentified error | Result will not be encrypted | | -1 | api decode failed | Result will not be encrypted | | -2 | raw format error | Result will not be encrypted | | -3 | Member verification failed | Result will not be encrypted | | -4 | Player Insufficient balance | Result will be encrypted | | -5 | Missing required parameters | Result will not be encrypted | | -6 | Bet amount format error | Result will not be encrypted | | -7 | Wallet is locked | Result will not be encrypted |