Skip to main content

Common Response Format

This section documents the common response format the invoker should expect from PHL.

Parameter Description

PropertyField TypeMandatoryDescription
createAtStringYTransaction creation date time, the time zone is GMT+8. Format: yyyyMMddHHmmss
dataStringYResponse content, by default the content is encoded by Base64
versionStringYAPI version
codeStringYSee Response Code
messageStringYMessage related to response code
signatureStringYMD5 signature is 32 characters, to prevent tampering during transmission

Data Description

Example API_001 Player Login response.

Before Base64 encode (sample data):

{"redirectUrl": "https://phl8268.com/token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlSWRzIjpbM10sInVzciI6IkplY2h0QWRtaW4iLCJpZCI6MjMsInBsYXRmb3JtSWQiOjEsImV4cCI6MTY4MjE5NTIwMSwiaWF0IjoxNjgxOTc5MjAxfQ.Rm49zDPdg-RnNJ7wmHp9mUQdOWWg_hPijORIwxGAbks"}

After Base64 encode:

eyJyZWRpcmVjdFVybDoiaHR0cHM6Ly9wbmwtMjkuY29tL3Rva2VuPWV5SjBlWEFpT2lKS1YxUWlMQ0poYkdjaU9pSklVekkxTmlKOS5leUp5YjJ4bFNXUnpJanBiTTEwc0luVnpjaUk2SWtwbFkyaDBRV1J0YVc0aUxDSnBaQ0k2TWpNc0luQnNZWFJtYjNKdFNXUWlPakVzSW1WNGNDSTZNVFk0TWpFNU5USXdNU3dpYVdGMElqb3hOamd4T1RjNU1qQXhmUS5SbTQ5ekRQZGctUm5OSjd3bUhwOW1VUWRPV1dnX2hQaWpPUkl3eEdBYmtzIn0=

Signature Description

Success:

{
"version": "1.0.0.0",
"createAt": "20230427142027",
"code": "2000",
"message": "Success",
"signature": "7C5EACA7F8ECC1536109938E3F4D0DE7",
"data": "eyJyZWRpcmVjdFVybDoiaHR0cHM6Ly91cG93ZXJiYWxsL3Rva2VuPWV5SjBlWEFpT2lKS1YxUWlMQ0poYkdjaU9pSklVekkxTmlKOS5leUp5YjJ4bFNXUnpJanBiTTEwc0luVnpjaUk2SWtwbFkyaDBRV1J0YVc0aUxDSnBaQ0k2TWpNc0luQnNZWFJtYjNKdFNXUWlPakVzSW1WNGNDSTZNVFk0TWpFNU5USXdNU3dpYVdGMElqb3hOamd4T1RjNU1qQXhmUS5SbTQ5ekRQZGctUm5OSjd3bUhwOW1VUWRPV1dnX2hQaWpPUkl3eEdBYmtzIn0g"
}

Failed:

{
"version": "1.0.0.0",
"createAt": "20230427142027",
"code": "4004",
"message": "User XXXXX not found.",
"signature": "CDCF3877C49225600C7DDC3FE8D19FF8",
"data": null
}

The signature is created by sorting each common parameter alphabetically and concatenating them with the + character. The parameter name and value are concatenated with the : character. Finally, the apiSecretKey is concatenated and encrypted with MD5, excluding the signature itself. The format should adhere to the specified pattern without any spaces:

code:{value}+createAt:{value}+data:{value}+message:{value}+version:{value}+apiSecretKey:{value}
note

The apiSecretKey is provided during merchant registration.

Concatenation example:

code:2000+createAt:2023-04-11T08:48:06+data:eyJyZWRpcmVjdFVybDoiaHR0cHM6Ly91cG93ZXJiYWxsL3Rva2VuPWV5SjBlWEFpT2lKS1YxUWlMQ0poYkdjaU9pSklVekkxTmlKOS5leUp5YjJ4bFNXUnpJanBiTTEwc0luVnpjaUk2SWtwbFkyaDBRV1J0YVc0aUxDSnBaQ0k2TWpNc0luQnNZWFJtYjNKdFNXUWlPakVzSW1WNGNDSTZNVFk0TWpFNU5USXdNU3dpYVdGMElqb3hOamd4T1RjNU1qQXhmUS5SbTQ5ekRQZGctUm5OSjd3bUhwOW1VUWRPV1dnX2hQaWpPUkl3eEdBYmtzIn0g+message:Success+version:1.0.0.0+apiSecretKey:3decbedb3ab4cef734fe00ebbe679501

After MD5 encryption and convert all to uppercase:

7C5EACA7F8ECC1536109938E3F4D0DE7