Skip to main content

5. Integration API

5.1 Operator Provided API

5.1.1 API Formats

5.1.1.1 Request

The API uses HTTP form methods and a RESTful endpoint structure. PGSoft will send requests in the following content type: Content-Type: application/x-www-form-urlencoded

5.1.1.2 Response

API returns JSON-formatted responses. For successful and failed API request, operator is required to return an API response with HTTP status code 200. API uses global JSON response format for all API methods, with the following content type: Content-Type: application/json

Parameters:

Parameter nameData TypeDescription
dataJSON ObjectResponse information for API methods
errorJSON ObjectError information when an error or exception occur

Example:

Success Response

{
"data": {
[API method response. JSON object format may vary depending on API methods]
},
"error": null,
}

Failed/Error Response

{
"data": null,
"error": {
"code": "[Error code]",
"message": "[Error message]"
}
}

5.1.1.3 Hash Authentication (Optional)

We highly recommend that operator integrate with hash authentication to secure every request. If operator choose to integrate with hash authentication, PGSoft system will validate the hash information provided in the header fields in every request.

5.1.1.3.1 Header Fields

The following table describes the various request headers in the preceding example:

ComponentDescription
HostAPI domain
Example:
apiexample.pgsoft.com
x-dateCurrent date (UTC) in YYYYMMDD format
Example:
20190902
x-content-sha256SHA256 hash of the request string body
Example:
1700116101f424b9f6fc695b4dbaf2b7b0ee763ba1b3b53298e3069143ed46f1
AuthorizationCombination of various components for requesting authentication
Example:
PWS-HMAC-SHA256<br/>Credential=20190902/OPERATORTOKENEXAMPLE/pws/v1,SignedHeaders=host;x-content-sha256;x-date,Signature=d78220cf06ae85f9d1db11dad9c3fd926799619eab3d28574aadb8cf328cd7aa

Example

Host: apiexample.pgsoft.com
x-date: 20190902
x-content-sha256:
1700116101f424b9f6fc695b4dbaf2b7b0ee763ba1b3b53298e3069143ed46f1
Authorization: PWS-HMAC-SHA256
Credential=20190902/OPERATORTOKENEXAMPLE/pws/v1,SignedHeaders=host

;x-content-sha256;x-
date,Signature=d78220cf06ae85f9d1db11dad9c3fd926799619eab3d28574aa

db8cf328cd7aa

Header: x-content-sha256

Calculate a SHA256 hash of the request string body:

POST body:
operator_token=abc123&secret_key=a1b25cde5f3gh46ijkl&count=5000&be
t_type=1&row_version=1346592723000
x-content-sha256:
1700116101f424b9f6fc695b4dbaf2b7b0ee763ba1b3b53298e3069143ed46f1

Header: Authentication

The following table describes the various components of the Authorization header value in the preceding example:

5.1.1.3.2 Header Authentication

ComponentDescription
CredentialYour access key ID and the scope information, which includes the date, operator token, and service that were used to calculate the signature.
This string has the following form:
{x-date}/{operator_token}/pws/v1
Example:
20190902/OPERATORTOKENEXAMPLE/pws/v1
SignedHeadersCurrent date (UTC) in YYYYMMDD format
Example:
20190902
x-content-sha256SHA256 hash of the request string body
Example:
1700116101f424b9f6fc695b4dbaf2b7b0ee763ba1b3b53298e3069143ed46f1
AuthorizationCombination of various components for requesting authentication
Example:
PWS-HMAC-SHA256

Credential=20190902/OPERATORTOKENEXAMPLE/pws/v1,SignedHeaders=host;x-content-sha256;x-date,Signature=d78220cf06ae85f9d1db11dad9c3fd926799619eab3d28574aadb8cf328cd7aa

To calculate a signature, you first need a string that includes {host}{x-content-sha256}{x-date}" to sign. You will then calculate a HMAC-SHA256 hash of the string to sign by using a signing key:

HMAC,"hmac-sha256(\{salt}, \{host}\{x-content-sha256}\{x-date})"

Calculate a HMAC-SHA256 hash of the string body:

Example

Salt : SALTEXAMPLE

Host : apiexample.pgsoft.com

x-date : 20190902

x-content-sha256 : 1700116101f424b9f6fc695b4dbaf2b7b0ee763ba1b3b53298e3069143ed46f1

Signature : d78220cf06ae85f9d1db11dad9c3fd926799619eab3d28574aadb8cf328cd7aa

5.1.2 Verify Session

PG SOFT game system will call this operator API to check the player session token generated when players login to game.

Note:

  • This API is required for URL scheme or web lobby authorization mode 14

  • New player will be created automatically

Request

API URL : {OperatorAPIDomain}/VerifySession HTTP method : POST

URL Parameters:

Parameter nameData TypeMandatoryDescription
trace_idStringYesUnique identity (GUID) of the request
Note
Please set the parameter value as GUID format

Body Parameters:

Parameter nameData TypeMandatoryDescription
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PG SOFT and operator
operator_player_sessionStringYesToken generated by operator's system when the game is launched (URL Scheme)
game_idIntegerNoUnique identity of games
ipStringNoPlayer IP address
custom_parameterStringNooperator_param values in URL scheme
bet_typeIntegerYesGame launch mode

Example:

URL:

https://operator.api/VerifySession?trace_id=b3f37e57-2873-40b1-aa95-f126c25ed311

Body operator_token=abc123&secret_key=a1b25cde5f3gh46ijkl&operator_player_session=a2b3c 4d5e6f7g8&game_id=1&ip=1.1.1.1&custom_parameter=operatorparam123&bet_type=1

Validation

Operator is required to perform validations to the following parameters:

Here is the data converted into CSV format:

Parameter nameDescriptionExpected behavior
operator_tokenMake sure the parameter value is the same as the one PG SOFT has provided.Return error when not match
secret_key
operator_player_sessionMake sure the operator_player_session matches with the token generated in URL scheme

Response

Body Parameters: JSON Object

Parameter nameData typeMandatoryDescription
player_nameStringYes"Unique identity of players
- player name is not case sensitive
- Only alphabet, number, and "@", "-", "_" symbols are allowed
Note: Max 50 characters"
nicknameStringNoNickname of player
Note: Max 50 characters"
currencyStringYesCurrency of player"

Example:

{
"data": {
"player_name": "player1",
"nickname":"nickname",
"currency": "USD"
},
"error": null
}

Error Response

CodeMessage
1034Invalid request
3005Player wallet does not exist

5.1.3 Wallet Operation (For Seamless Mode only)

5.1.3.1 Get Player Wallet

Operator is required to provide the total balance of the wallets that can be used in all PG SOFT games. It includes total balance in the cash wallet.

Request

API URL : {OperatorAPIDomain}/Cash/Get HTTP method : POST

URL Parameters:

Parameter nameData TypeMandatoryDescription
trace_idStringYesUnique identity (GUID) of the request
Note:
This ID is for issue troubleshooting only. Please do not use this ID in duplicate request validation

Body Parameters:

Parameter nameData TypeMandatoryDescription
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PG SOFT and operator
player_nameStringYesUnique identity of players
operator_player_sessionStringToken generated by operator's system when the game is launched (URL Scheme)
game_idIntegerNoUnique identity of games

Example:

URL:

https://operator.api/Cash/Get?trace_id=b3f37e57-2873-40b1-aa95-f126c25ed311

Body operator_token=abc123&secret_key=a1b25cde5f3gh46ijkl&player_name=player123&operato r_player_session=a2b3c4d5e6f7g8&game_id=1

Validation

Operator is required to perform validation to the following parameters:

Parameter_nameDescriptionExpected behaviour
operator_tokenMake sure the parameter value is the same as the one PG SOFT has provided.
secret_keyReturn error when not match
player_nameMake sure the parameter value matches the given player's name in Verify Session19

Response

Body Parameters: JSON Object

Parameter nameData typeMandatoryDescription
currency_codeStringYesCurrency of player
balance_amountDecimalYesCash Balance of player
Note:
- Supports up to 2 decimal places
- Extra decimal values will be truncated.
Example: Game will show 11.12 if balance_amount value is 11.125
updated_timeLongYesUpdated time of player record (Unix time stamp in milliseconds)

Example

{
"data": {
"currency_code": "CNY",
"balance_amount": 11.12,
"updated_time": 1530879795000
},
"error": null
}

Error Response

CodeMessage
1034Invalid request
3005Player wallet does not exist

5.1.3.2 Bet & Payout

PG SOFT system will expect idempotent operations for all API operations. Operator is required to perform duplicate request checking for all incoming transaction requests. PG SOFT may resend the transaction due to network difficulties or other unforeseen circumstances. Please refer to the following for the precautions and correct process flow to handle duplicated requests:

  • Operator is required to perform validation of operator_token and secret_key for every transaction request.
  • transaction_id is the only unique identifier for every transaction request, including bet and payout.
  • In the case where a request with the same transaction_id is found and operator has proceeded the previous request, please ignore the duplicated request, and return the previous successful response for the duplicated request.
  • In the case where a request with the same transaction_id is found and the previous request has failed, please retry, and return the corresponding results to PG SOFT.
  • In the case of a request with new transaction_id, operator may proceed to wallet addition or deduction accordingly, and return the successful response to PG SOFT.

Game Disconnected

In the case where players are encountering errors and have been disconnected from the game, PG SOFT system will automatically resume the game from its previous stage (including free spin, bonus, free game) without any alert on the next player login. Player will see the same screen before the error happened and will be able to continue the game from the previous stage.

Failed Transaction

PG SOFT games will stop and show errors when PG SOFT receives the following error codes during bet transactions:

  • 3004 PlayerNotFoundException
  • 3005 WalletNotFoundException
  • 3008 BonusNotFoundException
  • 3009 FreeGameNotFoundException
  • 3019 NotEnoughFreeGameException
  • 3021 BetNotFoundException
  • 3055 SnapshotNotFoundException
  • 3059 BetLimitExceededException
  • 3062 TransactionRolledBackException
  • 3073 BetFailedException
  • 3200 NotEnoughBalanceException
  • 3201 NotEnoughBonusBalanceException
  • 3202 NotEnoughCashBalanceException
  • 3094 MaximumBetLimitReachErrorCode
  • 3095 BalanceDecreasesLimitReachErrorCode

Operator should not cancel the pay-out transaction for a successful bet. System will always retry for a pay-out transaction until it is successful. Please contact PG SOFT if you would like to cancel the pay-out transaction.

5.1.3.2.1 Bet Payout

This transaction request is the combination of both bet and payout within a single request. PG SOFT system will call operator API in real time while the player is betting to achieve either the addition or deduction of the player's balance. Operator is required to respond within 10 seconds or API timeout will happen.

Request

API URL : {OperatorAPIDomain}/Cash/TransferInOut

HTTP method : POST

URL Parameters:

Parameter nameData TypeMandatoryDescription
trace_idStringYesUnique identity (GUID) of the request
Note:
Please set the parameter value as GUID format

Body Parameters:

CategoryParameter nameData TypeMandatoryDescription
Authentication
Information
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PG SOFT and operator
operator_player_sessionStringNoToken generated by operator system when game is launched (URL Scheme)
General Bet Informationplayer_nameStringYesUnique identity of players
game_idIntegerYesUnique identity of games
parent_bet_idStringYesUnique identity of parent bet
bet_idStringYesUnique identity of child bet
Note:
Unique key for bets
currency_codeStringYesCurrency of player
bet_amountDecimalYesBet amount.
Note:
PG SOFT will send a bet request with ZERO transfer amount for free spins
win_amountDecimalYesWin amount.
Note:
PG SOFT will send a payout request with ZERO transfer amount for the following:
- Every action (Example: split card) performed by player in card games
- Special feature in some slot games
transfer_amountDecimalYesPlayer Win Loss amount
Note:
The amount can be positive or negative
Negative: Balance deduction
Positive: Balance addition
transcation_idStringYesUnique identity of transaction.
Format: {BetId}-{ParentBetId}-{transactionType}-{balanceId}
Transaction type:106: BetPayout
400: BonusToCash 403: FreeGameToCash
Note:
- Max 50 characters
wallet_typeStringNoTo indicate the type of wallet for the current transaction.
C: Cash
B: Bonus
G: FreeGame
bet_typeIntegerYesBet types of bet record:
1: Real game
platformStringNoPlatform of player
create_timeLongYesBet start time and bet last updated time
(Unix time stamp in milliseconds)
Note:
updated_time is not equal to bet end time
updated_timeLongYes
Bet Indicatoris_validate_betBooleanNoTo indicate if the request is a transaction that has been resent for validation
True: Resent transaction
False: Normal transaction
is_adjustmentBooleanNoTo indicate if the request is an adjustment or a normal transaction for a pending bet
True: Adjustment
False: Normal transaction
is_parent_zero_stakeBooleanNoTo indicate if the request is having 0 bet amount for the first bet of the round.
True: Having 0 bet amount for the first bet of the round (For Bacarrat Deluxe’s free hands action)
False: Having amount larger than 0 in the first bet of the round
is_featureBooleanNoTo indicate the spin type
True: Feature spin
False: Normal spin
is_feature_buyBooleanNoTo indicate the feature buy
Note:
Only applicable for feature buy games
is_wagerBooleanNoTo indicate if the transaction is wager
True: bet_amount > 0
False: bet_amount = 0
is_end_roundBooleanNoTo indicate if the current game hand has ended
Free Game Informationfree_game
_transaction_id
StringNoUnique identity of free game.
It can only be seen when Free Game has been assigned to the player
Note:
Only available for free game created using External API
free_game_nameStringNoGiven name of free game.
It can only be seen when Free Game has been assigned to the player
free_game_idIntegerNoUnique identity of free game.
It can only be seen when Free Game has been assigned to the player
is_minus_countBooleanNoTo indicate the spin type in free game
True: Normal spin (Free game count is deducted)
False: Free spin
Bonus Game Informationbonus_transaction_idStringNoUnique identity of bonus game.
It can only be seen when Bonus Game has been assigned to the player
Note:
Only available for bonus game created using External API
bonus_nameStringNoGiven name of bonus game.
It can only be seen when Bonus Game has been assigned to the player
bonus_idIntegerNoUnique identity of bonus game.
It can only be seen when Bonus Game has been assigned to the player
bonus_balance_amountDecimalNoTotal number of bonus amount in bonus wallet.
It can only be seen when the player chooses to complete the bonus with cash.
bonus_ratio_amountDecimalNoRollover amount the player needs to achieve in bonus game.
It can only be seen when the player chooses to complete the bonus with cash.

Example

URL:

https://operator.api/Cash/TransferInOut?trace_id=b3f37e57-2873-40b1-aa95-f126c25ed311

Body:

operator_token=12345&secret_key=bfvcdbplayer_name=player123&operator_player_session=vcbcvbcvb&game_id=1&parent_bet_id=123456&bet_id=123456&bet_type=1&currency_code=EUR&create_time=1530879795000&updated_time=1530879795000&bet_amount=100&win_amount=40&transfer_amount=-60&transaction_id=123456-123456-106-0&wallet_type=C&is_feature=False&is_minus_count=False

Validation

Operator is required to perform validation to the following parameters:

Parameter nameDescriptionExpected behaviour
player_nameMake sure the parameter value matches the given player information in Verify SessionReturn error when not match
currency_code
operator_tokenMake sure the parameter value is the same as the one PG SOFT has provided.
secret_key
operator_player_sessionMake sure the operator_player_session matches the token generated in URL schemeReturn successful response even with outdated operator_player_session
Do not validate operator_player_session when is_validate_bet or is_adjustment parameter value is true
Note:
PG SOFT system may resend request for validation or pending bet
transfer_amountMake sure there is an error response when there is insufficient balanceReturn error response 3202
Make sure zero bet amount is accepted for parent bet
Note:
PG SOFT system will send a bet request with ZERO transfer amount for Bacarrat Deluxe’s free hands action
Return successful response with the correct cash balance
Make sure zero bet amount is accepted for child bet
Note:
PG SOFT system will send a bet request with ZERO transfer amount for free spin
transaction_idIgnore wallet operation for duplicated requests (Requests with the same transaction_id)
parent_bet_idProceed wallet operation for request with the same game hand (Requests with the same parent_bet_id but different bet_id)
bet_id

Response

Body Parameters: JSON Object

Parameter nameData typeMandatoryDescription
currency_codeStringYesCurrency of player
balance_amountDecimalYesCash Balance of player
Note:
- Support up to 2 decimal places
- Extra decimal values will be truncated.
Example: Game will show 11.12 if balance_amount value is 11.125
updated_timeLongYesUpdated time of transaction (Unix time stamp in milliseconds)
Note:
Response updated_time must be the same as the requested updated_time for transaction reference

Example:

{
"data": {
"currency_code": "CNY",
"balance_amount": 11.12,
"updated_time": 1530879795000
},
"error": null
}

Error Response

CodeMessage
3004Player does not exist
3005Player wallet does not exist
3021Bet does not exist
3033Bet failed
3202Insufficient player balance

5.1.3.3 Balance Adjustment

PG SOFT will use this API to perform player’s balance addition or deduction. This API can be used for certain events, such as Cash Tournament.

Request

API URL : {OperatorAPIDomain}/Cash/Adjustment

HTTPmethod : POST

Body parameters:

CategoryParameter nameData TypeMandatoryDescription
Authentication
Information
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PG SOFT and operator
General Bet Informationplayer_nameStringYesUnique identity of players
currency_codeStringYesCurrency of player
transfer_amountDecimalYesAdjustment Amount
Negative amount: Balance deduction
Positive amount: Balance addition
adjustment_idStringYesReference ID for Adjustment
adjustment_transaction_idStringYesUnique identity of transaction
Note:
- Max 200 characters
- Operator should use this parameter to check if the request is duplicated and implement idempotent operation
adjustment_timeLongYesAdjustment time
(Unix time stamp in milliseconds)
transaction_typeStringYesAdjustment source:
115: Promotion
900: External Adjustment
901: Tournament Adjustment
bet_typeIntegerYesGame launch mode
promotion_idIntegerNoReference ID for Promotion
promotion_typeIntegerNoPromotion Type:
1: Money Rain
2: Money Rain Daily Bonus
3: Daily Cashpot
remarkStringNoRemark for Balance Adjustment

Example

operator_token=abc123&secret_key=a1b25cde5f3gh46ijkl&player_name=player123&bet_typ e=1&currency_code=CNY&transfer_amount=100.00&adjustment_time=1530879795000&adjustm ent_id=ABC1530879&adjustment_transactionid=ABC1530879-900&transaction_type=900

Validation

Operator is required to perform validation to the following parameters:

Parameter nameDescriptionExpected behaviour
player_nameMake sure the parameter value matches the given player information in Verify SessionReturn error when not match
currency_code
operator_tokenMake sure the parameter value is the same as the one PG SOFT has provided.
secret_key
transfer_amountMake sure there is an error response when there is insufficient balance (negative transfer_amount)Return error response 3202
Make sure player balance after adjustment (amount with 2 decimal places) is correctReturn successful response with the correct balance
Make sure negative amount is accepted
Make sure the adjustment performs correctly and accordingly
- Negative: Balance deduction
- Positive: Balance addition
adjustment_transaction_idIgnore wallet operation for duplicated requests (Request with same transaction_id)

Response

Body Parameters: JSON Object

Parameter nameData typeMandatoryDescription
adjust_amountDecimalYesAdjusted Amount
Note:
- This amount is for reference purpose. PG SOFT will not validate it.
- Response adjust_amount must be the same as the requested transfer_amount for transaction reference
balance_beforeDecimalYesPlayer balance before adjustment (balance_before) & Player balance after adjustment (balance_after)
Note:
- Only support up to 2 decimals
- Extra decimal values will be truncated. Example: Game will show 11.12 if balance_amount value is 11.125
updated_timeLongYesUpdated time of transaction (Unix time stamp in milliseconds)
Note:
Response updated_time must be the same as the requested updated_time for transaction reference

Example

{
"data": {
"adjust_amount": 100.00,
"balance_before": 0.00,
"balance_after": 100.00,
"updated_time": 1530879795000
},
"error": null
}

Error Response

CodeMessage
3004Player does not exist
3005Player wallet does not exist

5.1.3.4 Update Bet Details

PG SOFT game system will call this operator API to update the operator’s latest bet end time when the bet is successful in PG SOFT system.

Request

API URL : {OperatorAPIDomain}/Cash/UpdateBetDetail

HTTP method : POST

Body Parameters:

Parameter nameData TypeMandatoryDescription
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PG SOFT and operator
bet_detailsJson ArrayYesList of bet ID with bet end time
updated_timeLongYesAPI request time
(Unix time stamp in milliseconds)

Parameter: bet_details

Parameter nameData TypeMandatoryDescription
bet_idStringYesUnique identity of child bet
Note:
Unique key for bets
end_timeLongYesBet end time
(Unix time stamp in milliseconds)

Example: operator_token=abc123&secret_key=a1b25cde5f3gh46ijkl&bet_details=[{"bet_id":"1456887894","e nd_time":"1644476958000"},{"bet_id":"1456887895","end_time":"1644476958000"}]&updated_ti me=1645414794000

Validation

Operator is required to perform validation to the following parameters

Parameter nameDescriptionExpected behavior
operator_tokenMake sure the parameter value is the same as the one PG SOFT has provided.Return error when not match
secret_key

Response

Body Parameters: JSON Object

Parameter nameData TypeMandatoryDescription
is_successBooleanYesTo indicate if the request is received
True: Received
False: Not Received

Example

{
"data": {
"is_success": true,
},
"error": null,
}

5.2 PG SOFT Provided API

5.2.1 API Formats

5.2.1.1 Request

The API uses HTTP form methods and a RESTful endpoint structure. Operator is required to send requests in the following content type:

Content-Type: application/x-www-form-urlencoded

5.2.1.2 Response

API returns JSON-formatted responses. For successful and failed API requests, PG SOFT system will return an API response with HTTP status code 200.

API uses global JSON response format for all API methods, with the following content type:

Content-Type: application/json

Parameters

Parameter nameData TypeDescription
dataJSON ObjectResponse information for API methods
errorJSON ObjectError information when an error or exception occur

Example

Successful Response

{
"data": {
[API method response. JSON object format may vary depending on API methods]
},
"error": null,
}

Failed/Error Response

{
"data": null,
"error": {
"code": "[Error code]",
"message": "[Error message]"
}
}

5.2.2 Check Player’s Balance (For Transfer Mode only)

To check a specific player's balance.
Request

API URL : {PgSoftAPIDomain}/Cash/v3/GetPlayerWallet
HTTP method : POST

URL Parameter:

Parameter nameData TypeMandatoryDescription
trace_idStringYesUnique identity (GUID) of the request
Note: Please set the parameter value as GUID format

Body Parameter:

Parameter nameData TypeMandatoryDescription
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PGSoft and operator
player_nameStringYesUnique identity of players

Example:

URL:
https://api.pg-bo.me/external/Cash/v3/GetPlayerWallet?trace_id=b3f37e57-2873-40b1-aa95-f126c25ed311

Body:
operator_token=abc123&secret_key=a1b25cde5f3gh46ijkl&player_name=player123

Response
Body Parameters:
JSON Object

Parameter nameData typeDescription
currencyCodeStringCurrency of player Summation of all player wallet balance: - Cash balance - Bonus balance - Free game balance
totalBalanceDecimalSummation of all player wallet balance:
- Cash balance
- Bonus balance
- Free game balance
cashBalanceDecimalPlayer's cash wallet balance
Operator may refer to this value for player's balance
totalBonusBalanceDecimalPlayer’s bonus wallet balance. This will show all the available bonus balance of a player. It cannot be transferred out.
freeGameBalanceDecimalPlayer’s free game wallet balance. This will show all the available free game balance of a player. It cannot be transferred out.
bonusesJSON ArrayPlayer's bonus game details
freeGamesJSON ArrayPlayer's free game details
cashWalletJSON ObjectPlayer's cash wallet details
keyStringUnique identity of cash wallet
cashIdIntegerUnique identity of player's cash wallet
cashBalanceDecimalPlayer's balance of cash
bonusWalletJSON ObjectPlayer's bonus wallet details
totalBonusBalanceDecimalSummation of player's bonus wallet balance
freeGameWalletJSON ObjectPlayer's free game wallet details
freeGameBalanceDecimalSummation of player's free game wallet balance

JSON Array (Bonus Game)

Parameter nameData typeDescription
keyStringUnique identity of bonus wallet.
bonusIdIntegerUnique identity of bonus game. It can only be seen after Bonus Game has been assigned to the player.
bonusNameStringGiven name of bonus game. It can only be seen after Bonus Game has been assigned to the player.
transactionIdStringUnique identity of transaction
bonusParentTypeStringType of bonus parent:
Bonus: Bonus game that was created normally
FreeGame: Bonus game that was converted from free game
gameIdsInteger ArrayUnique identity of games
gameIdLockIntegerAn unfinished game's ID
balanceAmountDecimalPlayer's balance of bonus game
bonusRatioAmountDecimalWagering requirement for bonus game. Refer to the total amount that needs to be completed after the amount won in bonus game has been transferred to the bonus wallet
minimumConversionAmountDecimalThe minimum amount of bonus game to cash conversion
maximumConversionAmountDecimalThe maximum amount of bonus game to cash conversion
statusIntegerStatus of bonus wallet:
0: Inactive (Cancelled)
1: Active
2: Expired
3: Converted
4: Completed
5: New
6: User Cancelled
7: Locked
8: Pending
createdDateLongCreated date of bonus game (Unix time stamp in milliseconds)
expiredDateLongExpiry date of bonus game (Unix time stamp in milliseconds)
createdByStringAPI or BackOffice user who created the bonus game
updatedByStringAPI or BackOffice user who updated the bonus game Allowing a player to cancel an offer:
isSuppressDiscardBooleanTrue: Does not allow a player to cancel offer False: Allows a player to cancel offer

JSON Array (Free Game)

Parameter nameData typeDescription
keyStringUnique identity of free game wallet
freeGameIdIntegerUnique identity of free game
It can only be seen after Free Game has been assigned to the player.
freeGameNameStringGiven name of free game
It can only be seen after Free Game has been assigned to the player.
transactionIdStringUnique identity of transaction
gameIdsInteger ArrayUnique identity of games
gameIdLockIntegerAn unfinished game's ID
gameCountIntegerTotal number of remaining free games
totalGameIntegerTotal number of given free games
balanceAmountDecimalPlayer's balance of free game
minimumConversionAmountDecimalThe minimum amount of free game to cash conversion
maximumConversionAmountDecimalThe maximum amount of free game to cash conversion
multiplierIntegerBet multiplier of free game
coinSizeDecimalCoin size of free game
createdDateLongCreated date of free game (Unix time stamp in milliseconds)
expiredDateLongExpiry date of free game (Unix time stamp in milliseconds)
statusIntegerStatus of free game wallet:
0: Inactive (Cancelled)
1: Active
2: Expired
3: Converted
4: Completed
5: New
6: User Cancelled
7: Locked
8: Pending
conversionTypeCharType of conversion after free game is completed:
C: Cash
B: Bonus
createdByStringAPI or BackOffice user who created the free game
updatedByStringAPI or BackOffice user who updated the free game
isSuppressDiscardBooleanAllowing a player to cancel an offer:
True: Does not allow a player to cancel offer
False: Allows a player to cancel offer

Example:

{
"data": {
"currencyCode": "CNY",
"totalBalance": 50732.39,
"cashBalance": 48853.39,
"totalBonusBalance": 1815.00,
"freeGameBalance": 64.00,
"bonuses": [
{
"key": "11019-97090_B",
"bonusId": 11019,
"bonusName": "PG Bonus ",
"transactionId": "",
"bonusParentType": "Bonus",
"gameIds": [
94,
69,
71
],
"gameIdLock": 0,
"balanceAmount": 1000.00,
"bonusRatioAmount": 1000.00,
"minimumConversionAmount": 0.00,
"maximumConversionAmount": 0.00,
"status": 5,
"createdDate": 1615952183000,
"expiredDate": 1640966399000,
"createdBy": "operator1",
"updatedBy": "operator1",
"isSuppressDiscard": true
}
],
"freeGames": [
{
"key": "575-16084_G",
"freeGameId": 575,
"freeGameName": "FREE GAME",
"transactionId": "",
"gameIds": [
33
],
"gameIdLock": 0,
"gameCount": 0,
"totalGame": 100,
"balanceAmount": 0.00,
"minimumConversionAmount": 0.00,
"maximumConversionAmount": 0.00,
"multiplier": 6,
"coinSize": 0.1,
"createdDate": 1544582329000,
"expiredDate": 1544630399000,
"status": 3,
"conversionType": "C",
"createdBy": "operator2",
"updatedBy": "operator2",
"isSuppressDiscard": false
}
],
"cashWallet": {
"key": "0_C",
"cashId": 0,
"cashBalance": 48853.39
},
"bonusWallet": {
"totalBonusBalance": 1815.00,
"bonuses": [
{
"key": "11019-97090_B",
"bonusId": 11019,
"bonusName": "PG Bonus ",
"transactionId": "",
"bonusParentType": "Bonus",
"gameIds": [
94,
69,
71
],
"gameIdLock": 0,
"balanceAmount": 1000.00,
"bonusRatioAmount": 1000.00,
"minimumConversionAmount": 0.00,
"maximumConversionAmount": 0.00,
"status": 5,
"createdDate": 1615952183000,
"expiredDate": 1640966399000,
"createdBy": "operator3",
"updatedBy": "operator3",
"isSuppressDiscard": true
}
]
},
"freeGameWallet": {
"freeGameBalance": 64.00,
"freeGames": [
{
"key": "575-16084_G",
"freeGameId": 575,
"freeGameName": "FREE GAME",
"transactionId": "",
"gameIds": [
33
],
"gameIdLock": 0,
"gameCount": 0,
"totalGame": 100,
"balanceAmount": 0.00,
"minimumConversionAmount": 0.00,
"maximumConversionAmount": 0.00,
"multiplier": 6,
"coinSize": 0.1,
"createdDate": 1544582329000,
"expiredDate": 1544630399000,
"status": 3,
"conversionType": "B",
"createdBy": "operator4",
"updatedBy": "operator4",
"isSuppressDiscard": false
}
]
}
},
"error": null
}

Error Response:

CodeMessage
3001Value cannot be null
3005Player wallet does not exist

5.2.3 Transfer In and Transfer Out (For Transfer Mode only)

PGSoft systems are implementing idempotent operations for all API operations. Operator is required to resend the request by using the same transfer_reference for the following scenarios:

  • Received incorrect response (incorrect response format) from PGSoft system.
  • Received response with error code other than 3001, 3005 or 3100.
  • Did not receive a response from PGSoft system.

5.2.3.1 Transfer In

To transfer cash into a specific player's cash wallet.
Note:

  • Transfer_reference is the unique identifier for every transaction. Operator is required to send new transfer_reference for every transfer request.
  • For duplicated requests, PGSoft will not update the player’s wallet balance, and will return a successful response for the duplicated request.

Request

API URL : {PgSoftAPIDomain}/Cash/v3/TransferIn
HTTP method : POST

URL Parameter:

Parameter nameData TypeMandatoryDescription
trace_idStringYesUnique identity (GUID) of the request
Note: Please set the parameter value as GUID format

Body Parameter:

Parameter nameData TypeMandatoryDescription
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PGSoft and operator
player_nameStringYesUnique identity of players
amountDecimalYesTransfer in amount (2 decimal place)
Note: Min 0.01
currencyStringYesCurrency of player
transfer_referenceStringYesTransfer reference, generated by operator to make sure the transfer is unique
Note: Max 50 characters

Example:

URL:
https://api.pg-bo.me/external/Cash/v3/TransferIn?trace_id=b3f37e57-2873-40b1-aa95-f126c25ed311

Body:
operator_token=abc123&secret_key=a1b25cde5f3gh46ijkl&player_name=player123&amount=0.30&transfer_reference=ref1530879795000&currency=EUR

Response
Body Parameters:
JSON Object

Parameter nameData typeDescription
transactionIdStringUnique transaction identifier
balanceAmountBeforeDecimalPlayer's balance before transaction
balanceAmountDecimalPlayer's balance after transaction
amountDecimalTransaction amount

Example:

{
"data": {
"transactionId": 35509540,
"balanceAmountBefore": 1000.00,
"balanceAmount": 1100.00,
"amount": 100.00
},
"error": null
}

Error Response

CodeMessage
3001Value cannot be null
3005Player wallet does not exist
3100Wallet transaction failed
3101Wallet transaction in progress, please retry again

5.2.3.2 Transfer Out

To transfer out cash from a specific player's cash wallet.
Note:

  • Transfer_reference is the unique identifier for every transaction. Operator is required to send new transfer_reference for every transfer request.
  • For duplicated requests, PGSoft will not update player’s wallet balance, and will return a successful response for the duplicated request.

Request

API URL : {PgSoftAPIDomain}/Cash/v3/TransferOut
HTTP method : POST

URL Parameter:

Parameter nameData TypeMandatoryDescription
trace_idStringYesUnique identity (GUID) of the request
Note: Please set the parameter value as GUID format

Body Parameter:

Parameter nameData TypeMandatoryDescription
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PGSoft and operator
player_nameStringYesUnique identity of players
amountDecimalYesTransfer in amount (2 decimal place)
Note: Min 0.01
currencyStringYesCurrency of player
transfer_referenceStringYesTransfer reference, generated by operator to make sure the transfer is unique
Note: Max 50 characters

Example:

URL:
https://api.pg-bo.me/external/Cash/v3/TransferOut?trace_id=b3f37e57-2873-40b1-aa95-f126c25ed311

Body:
operator_token=abc123&secret_key=a1b25cde5f3gh46ijkl&player_name=player123&amount=0.30&transfer_reference=ref1530879795000&currency=EUR

Response
Body Parameters:
JSON Object

Parameter nameData typeDescription
transactionIdStringUnique transaction identifier
balanceAmountBeforeDecimalPlayer's balance before transaction
balanceAmountDecimalPlayer's balance after transaction
amountDecimalTransaction amount

Example:

{
"data": {
"transactionId": 35509540,
"balanceAmountBefore": 1000.00,
"balanceAmount": 1100.00,
"amount": 100.00
},
"error": null
}

Error Response

CodeMessage
3001Value cannot be null
3005Player wallet does not exist
3100Wallet transaction failed
3101Wallet transaction in progress, please retry again

5.2.4 Wallet Operation Restriction and Handling (For Transfer Mode only)

Performing a wallet transaction and launching a game at the same time is prohibited to avoid errors in player’s balance. In such cases, PGSoft will restrict the player and return an error response for the wallet API request:

1305: Invalid player - Player is locked: [playername]

Error Handling
1305
Operator should resend the wallet transaction request if they receive this error. PGSoft systems are implementing idempotent operations for all API operations. Operator is required to resend the request by using the same transfer_reference to avoid multiple balance transfer.

3004
PGSoft will return this error if an unhandled error occurs while creating a player. Operator may recreate the player’s wallet by External API or relaunching the PGSoft game to create the player automatically.

1315
PGSoft will return this error when encountering the following scenarios:

  • Concurrent actions (For example: The player launched the game with two different browsers at the same time, etc.).
  • Player launched the game or a spin in the game while doing a transaction at the same time.
  • Player wallet not found.
  • Encountering errors during the wallet transfer.

Operator should retry the wallet transaction request after 5 minutes if they receive this error.

5.2.5 Transfer All Out (Optional - For Transfer Mode only)

To transfer out all cash wallet amount from a specific player's cash wallet.

Note:

  • Transfer_reference is the unique identifier for every transaction. Operator is required to send new transfer_reference for every transfer request.
  • For duplicated requests, PGSoft will not update player’s wallet balance, and will return a successful response for the duplicated request.
  • This API is to clean up a player’s wallet balance. The system will NOT return any error if the player has no balance. Operator is required to check the player’s before and current balance amount in the API response to confirm the actual withdrawal amount to avoid missing balance.

Request

API URL : {PgSoftAPIDomain}/Cash/v3/TransferAllOut
HTTP method : POST

URL Parameter:

Parameter nameData TypeMandatoryDescription
trace_idStringYesUnique identity (GUID) of the request
Note: Please set the parameter value as GUID format

Body Parameter:

Parameter nameData TypeMandatoryDescription
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PGSoft and operator
player_nameStringYesUnique identity of players
transfer_referenceStringYesTransfer reference, generated by operator to make sure the transfer is unique
Note: Max 50 characters
currencyStringYesCurrency of player

Example:

URL:
https://api.pg-bo.me/external/Cash/v3/TransferAllOut?trace_id=b3f37e57-2873-40b1-aa95-f126c25ed311

Body:
operator_token=abc123@secret_key=a1b25cde5f3gh46ijkl&player_name=player123&transfer_reference=ref153087975000&currency=EUR

Response:

Parameter nameData TypeDescription
transactionIdStringUnique transaction identifier
balanceAmountBeforeDecimalPlayer’s balance before transaction
balanceAmountDecimalPlayer’s balance after transaction
amountDecimalTransaction amount

Example:

{
"data": {
"transactionId":12458888,
"balanceAmountBefore": 47238.07,
"balanceAmount": 0,
"amount": 47238.07,
},
"error": null
}

Error Response:

CodeMessage
3001Value cannot be null
3005Player wallet does not exist

5.2.6 Get Single Transaction History (Optional - For Transfer Mode only)

To get a single transaction history of a specific player by searching the transfer reference and player’s username.

Note:

  • This API can be only called after 5 minutes of the last transaction.

Request

API URL : {PgSoftAPIDomain}/Cash/v3/GetSingleTransaction
HTTP method : POST

URL Parameters:

Parameter nameData TypeMandatoryDescription
trace_idStringYesUnique identity (GUID) of the request
Note: Please set the parameter value as GUID format

Body Parameter:

Parameter nameData TypeMandatoryDescription
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PGSoft and operator
player_nameStringYesUnique identity of players
transfer_referenceStringYesTransfer reference, generated by operator to make sure the transfer is unique
Note: Max 50 characters

Example:

URL:
https://api.pg-bo.me/external/Cash/v3/GetSingleTransaction?trace_id=b3f37e57-2873-
40b1-aa95-f126c25ed311

Body:
operator_token=abc123&secret_key=a1b25cde5f3gh46ijkl&player_name=player123&transfe
r_reference=ref1530879795000

Response
Body Parameters:
JSON Object

Parameter nameData TypeDescription
transactionIdStringUnique transaction identifier
playerNameStringUnique identity of players
currencyCodeStringCurrency of player
transactionTypeIntegerTransaction type:
100: TransferInCash
200: TransferOutCash
transactionAmountDecimalTransaction amount
transactionFromDecimalWallet balance before transaction
transactionToDecimalWallet balance after transaction
transactionDateTimeLongTransaction date & time (Unix time stamp in milliseconds)

Example:

{
"data": {
"transactionId": 35595943,
"playerName": "player123",
"currencyCode": "EUR",
"transactionType": 100,
"transactionAmount": 1000000.00000,
"transactionFrom": 0.00,
"transactionTo": 1000000.00,
"transactionDateTime": 1522984865000

},
"error": null
}

Error Response:

CodeMessage
3040Transaction does not exist

5.2.7 Bet History Interpreter (Optional)

To reveal a player’s bet results and details for specific bet.

Step 1

Before getting the bet detail, operator is required to call this API to get operator's session (Session timeout: 30 minutes).

Request

API URL : {PgSoftAPIDomain}/Login/v1/LoginProxy

HTTP method : POST URL Parameters:

URL Parameters:

Parameter nameData TypeMandatoryDescription
trace_idStringYesUnique identity (GUID) of the request
Note
Please set the parameter value as GUID format

Body Parameters:

Parameter nameData TypeMandatoryDescription
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PG SOFT and operator

Example: URL: https://api.pg-bo.me/external/Login/v1/LoginProxy?trace_id=b3f37e57-2873-40b1-aa95-f126c25ed311

Body:

operator_token=abc123&secret_key=a1b25cde5f3gh46ijkl

Response

Body Parameters: JSON Object

Parameter nameData TypeDescription
operator_sessionStringOperator session

Example:

{
"data": {
"operator_session":"E4ECB5CF-0BC6-4DA8-8551-8526F48AB9CD"
},
"error": null
}

Step 2

Get bet detail by:

API URL : {PgSoftPublicDomain}/history/redirect.html HTTP method : Get

URL Parameters:

Parameter nameData TypeDescription
trace_idStringUnique identity (GUID) of the request
Note
Please set the parameter value as GUID format
tStringOperator session from Step 1
psidStringParent Bet ID
sidStringBet ID
langStringLanguage:
- en(default)
- zh
typeStringFixed value: operator

Example:

https://public.pg-redirect.net/history/redirect.html?trace_id=b3f37e57-2873-40b1-aa95-f126c25ed311&t=E4ECB5CF-0BC6-4DA8-8551-8526F48AB9CD&psid=12345&sid=12345&lang=en&type=operator

5.2.8 Get Multiple Players’ Wallet Balance (Optional - For Transfer Mode only)

To get the wallet balance of multiple players (max 10 players).
Note:

  • The maximum amount of players’ wallet balance that can be obtained is 10.

Request

API URL : {PgSoftAPIDomain}/Cash/v3/GetPlayersWallet
HTTP method : POST

URL Parameters:

Parameter nameData TypeMandatoryDescription
trace_idStringYesUnique identity (GUID) of the request
Note: Please set the parameter value as GUID format

Body Parameter:

Parameter nameData TypeMandatoryDescription
operator_tokenStringYesUnique identity of operator
secret_keyStringYesShared passphrase between PGSoft and operator
player_namesString ArrayYesUnique identity of players

Example:

URL:
https://api.pg-bo.me/external/Cash/v3/GetPlayersWallet?trace_id=b3f37e57-2873-40b1-aa95-f126c25ed311

Body:
operator_token=abc123&secret_key=a1b25cde5f3gh46ijkl&player_names=player1&player_names=player2

Response
Body Parameters:
JSON Object

Parameter nameData TypeDescription
totalCountIntegerTotal number of records
totalPageIntegerTotal number of available batches
resultJSON ArrayList of details of a player’s wallet

JSON Array

Parameter nameData TypeDescription
playerNameStringName of player
currencyCodeStringCurrency of player
totalBalanceDecimalPlayer’s wallet balance

Example:

{
"data": {
"totalCount": 2,
"totalPage": 1,
"result": [
{
"playerName": "player1",
"currencyCode": "CNY",
"totalBalance": 33.59
},
{
"playerName": "player2",
"currencyCode": "CNY",
"totalBalance": 2000061103.84
}
]
},
"error": null
}

Error Response:

CodeMessage
3001Value cannot be null
3005Player wallet does not exist

5.2.9 Others (Optional)

PG SOFT provides several APIs for different modules that are optional for integration. Operator may choose to integrate based on their requirements:

  • Bet History: To get a player’s bet history
  • Game List: To get the latest game list and available bet sizes
  • Free Game: To perform several actions (For example: Create free game, assign player into free game, cancel free game, etc.) through API.
  • Bonus Game: To perform several actions (For example: Create bonus game, assign player into bonus game, cancel bonus game, etc.) through API.
  • Tournament: To get tournament list, add player into tournament and get tournament ranking through API.

5.3 Integrate PG SOFT Game into Operator’s iOS Application

Operator’s application needs to meet the following requirements to launch PG SOFT games in the application client:

  • iOS 8.0 or above
  • WKWebView

PG SOFT game will prompt a “Poor Visit Experience” message if it does not meet the minimum requirements. Players are allowed to continue launching the game but it may not guarantee a stable, and high performance experience of the PG SOFT game.

To ensure the application client passes the PG SOFT game requirement check, operator is required to include the following codes when initializing WKWebView component in application:

This is to construct a WKUserContentController object and set its userContentController property on the configuration. Please take note that the userContentController must have at least one scriptMessageHandler (assign through addScriptMessageHandler)

For more details regarding WKWebView, please refer to Apple Developer Documentation