page icon

REST API Specification 0.0.3

This document provides specifications for integrating with the Game8 Store API.
 

API List


Publisher APIs

Game8 Store calls these APIs.
API NameEndpointMethodRequiredDescription
Purchase Eligibility CheckRequiredChecks if a user is eligible to purchase a specified item
Register PurchaseRequiredGrants in-game items after purchase completion
Retrieve Player InformationRecommendedRetrieves the player's name and level based on their in-game ID.

1. Common Specifications


ItemDetails
HostGame8-provided APIs: Publisher-provided APIs:
ProtocolHTTPS
Character EncodingUTF-8

1.1. Request Specifications

1.1. Request Headers

KeyValueDescription
AuthorizationBearer Authentication information
Content-Typeapplication/jsonContent type
X-SignatureSignature for verification
The access token must be a randomly generated string of 16 to 36 alphanumeric characters, including both uppercase and lowercase letters, issued for each game.
Game8, Inc. will generate and provide the access token. However, if you prefer to generate it yourself, please contact us.

1.2. Response Specifications

Common Response Headers

KeyValue
Content-Typeapplication/json

Common Response Body

KeyValueDescription
request_idA unique request ID. Used for tracking requests during troubleshooting.
timestampResponse timestamp
result_codeResult code
messageMessage
If an error from the error code list occurs, only the common response body fields will be returned.

1.3. X-Signature Configuration

To verify whether a request is legitimate, a game-specific shared secret key is used to sign the request, which is then included in the request header for validation.

Signature Generation Process

  1. Calculate the digest based on the query string for GET requests and the request body for POST requests. The digest is calculated using HMAC-SHA256 with the shared secret key.
Examples of messages used for digest calculation
For GET: game=game123&user=user456&...
For POST: {"game":"game123","user":"user456",...}
  1. Encode the computed digest in Base64 and set it in the request header as .

Signature Verification Process

  1. Calculate the digest based on the query string for GET requests and the request body for POST requests.The digest is calculated using HMAC-SHA256 with the shared secret key.
Examples of messages used for digest calculation
For GET: game=game123&user=user456&...
For POST: {"game":"game123","user":"user456",...}
  1. Encode the computed digest in Base64 and compare it with the in the request header.
    1. If they match, process the request as legitimate.
    2. If they do not match, return an error as an invalid request.

How to Obtain the Secret Key

Game8, Inc. will generate and share the private key with you.

2. Publisher APIs


2.1. Purchase Eligibility Check (GET /check)

Overview

Checks whether an in-game item can be purchased, considering factors such as age restrictions and purchase limits.
To prevent purchase failures due to time lag in payment processing for limited-quantity items, a is used to secure the target item.

Request Specifications

ItemDetails
MethodGET
Endpoint
ProtocolHTTPS
Content Typeapplication/json

Request Headers

KeyValueDescription
AuthorizationBearer Authentication information
Content-Typeapplication/jsonContent type
X-SignatureSignature for verification

Query Parameter

KeyTypeRequiredDescription
gamestringUnique game ID issued within Game8Store
userstringUnique in-game user ID issued within the game
transaction_idstringIdentifier that uniquely identifies a transaction
itemstringUnique ID of the item to be purchased within the game (
priceintegerSelling price of the item in Game8Store (tax included, JPY)

Request Example

Response Specifications

Response Body
KeyTypeDescription
request_idstringUnique request ID
timestampstring (ISO8601)Response timestamp
result_codestringResult code
messagestringMessage
purchasablestringPurchase status: : Can be purchased : Cannot be purchased : Under maintenance
age_categorystringUser's age category. Examples include , , , , and , but other values can be set as needed.
monthly_limitintegerMonthly purchase limit (yen). means no limit.
remaining_limitintegerRemaining purchase limit (yen). means no limit.
requested_priceintegerRequested item price (tax included, JPY)

Response Example (Purchasable)

Response Example (Not Purchasable - Age Verification Not Submitted)

Response Example (Not Purchasable - Purchase Limit Exceeded)

Response Example (Not Purchasable - Item Not Available for Sale)

Response Example (Not Purchasable - Under Maintenance)

2.2. Register Purchase (POST /register)

Overview

Processes the addition of in-game items after purchase completion.
We recommend implementing the following processes before registering purchase records:
  • Only accept requests that include a transaction_id that has passed through the item purchase eligibility check API
  • Verify that the purchase does not violate any purchase limitations

Request Specifications

ItemDetails
MethodPOST
Endpoint
ProtocolHTTPS
Content Typeapplication/json

Request Headers

KeyValueDescription
AuthorizationBearer Authentication information
Content-Typeapplication/jsonContent type
X-SignatureSignature for verification

Request Body

KeyTypeRequiredDescription
gamestringUnique game ID issued within Game8Store
userstringUnique in-game user ID issued within the game
itemstringUnique ID of the item to be purchased within the game (
transaction_idstringIdentifier that uniquely identifies a transaction
item_namestringName of the purchased item (e.g., "100 Gem Pack")
priceintegerSelling price of the item in Game8Store (tax included, JPY)
contentsarrayList of contents included in the item

Data structure of the Array

KeyTypeRequiredDescription
content_idstringAutomatically assigned content ID within the item, using as a prefix with a suffix (e.g., )
content_namestringName of the content within the item (e.g., "Gem")
quantityintegerQuantity of the content within the item (e.g., 1000)

Request Example

Response Specifications

Response Body

KeyTypeDescription
request_idstringUnique request ID
timestampstring (ISO8601)Response timestamp
result_codestringResult code
messagestringMessage
item_grantedbooleanWhether the in-game item was granted ( / )

Response Example (Success)

Response Example (Failure - Unknown User)

Response Example (Failure - Already Registered Transaction ID)

2.5. Retrieve Player Information (GET /user_info)

Overview

Retrieves player name and level based on the game ID entered by the user. Displaying this information on the purchase confirmation screen allows users to verify the accuracy of their entered ID and confirm proper connectivity with the game.

Request Specifications

ItemDetails
MethodGET
Endpoint
ProtocolHTTPS
Content Type

Request Headers

KeyValueDescription
AuthorizationAuthentication information
Content-TypeContent type
X-SignatureSignature for verification

Query Parameter

KeyTypeRequiredDescription
gamestringUnique game ID issued within Game8Store
userstringUnique in-game user ID issued within the game

Request Example

Response Specifications

Response Body

KeyTypeRequiredDescription
request_idstringUnique request ID
timestampstring (ISO8601)Response timestamp
result_codestringResult code
messagestringMessage
user_namestringPlayer name (can be masked)
user_levelintegerPlayer level or rank. Returns if no such information exists in the game.
Since this API can retrieve other players' names using the entered in-game ID, consider masking player names as needed.

Masking Examples for

Player NameMasked
aa*a
aaa*aa
aaaa**aa
aaaaa***aa

Response Example (Success)

Response Example (Failure - Player ID Not Found)

Response Example (Failure - Account Banned or Inactive)

Response Example (Failure - Server Maintenance)

3. Error Handling


3.1. Error Code List

Error CodeDescriptionSolution
Success-
Invalid request formatCheck the request structure and required parameters, and send in the correct format.
Missing authentication credentialsEnsure the header contains the correct .
Invalid access tokenCheck the token's validity and reissue it if necessary.
Insufficient access permissionsVerify that the API endpoint has the necessary permissions.
Signature mismatchEnsure that the secret key used for the signature is correct.
Processed requestsEnsure that duplicate are not sent.
Missing required parametersCheck the required parameters and correct the request.
Invalid parameter typeExample: If is sent as a , convert it to an integer.
Invalid parameter valueEnsure no unauthorized or out-of-range values are sent.
Data not foundVerify that the specified or exists.
Purchase limit exceededCheck the value and ensure it is within the allowed range.
Age verification not completedPrompt the user to complete age verification within the game.
Item no longer available for saleContact the sales or development team for store adjustments.
Account suspended, purchase unavailable-
Invalid transaction IDEnsure that is correct.
Specified user not foundVerify that the is correct.
Specified item not foundEnsure that the is valid.
Transaction ID already registeredVerify that is correct.
Internal server errorA server-side issue may have occurred; retry after some time.
Temporary system failureRetry (recommended: retry after 5 seconds).
Unknown errorCheck the detailed error message and contact the development team.
Under maintenanceThe service is temporarily unavailable; retry after some time.

3.2. Recommended Error Handling Flow

  1. Check the
      • If (Success), proceed as normal.
      • Otherwise, determine the type of error.
  1. Determine if the error can be fixed on the client side
      • series and series errors can typically be resolved by correcting the request.
      • series errors require data consistency verification.
  1. Check if the error is retryable
      • and are likely temporary errors, so retrying after a few seconds is recommended.
  1. Log and report errors
      • For unknown errors (), record logs and notify the development team.

3.3. Retry Policy

Error CodeRetry IntervalMax RetriesNotes
After 5 seconds3 timesInternal server errors may be resolved quickly.
After 10 seconds5 timesLonger interval recommended due to temporary system failures.
None0 timesUnknown errors should be reported immediately.
Use this error handling list as a reference to implement proper error management in your system.