Skip to content

Web Shop Purchase Limit Validation API

'Web Shop purchase limit validation' verifies whether a product purchased in the Web Shop exceeds the maximum purchase quantity. Hive provides the Web Shop payment information validation API for this feature.

Prerequisites

Before calling the Web Shop payment information validation API, configure the maximum purchase quantity in Hive Console. In Hive Console > Community & Web Shop > Web Shop > Product Management, use purchase quantity limit validation settings to set per-account purchase limits and purchase quantity limits for Web Shop products. You can set a maximum purchase quantity for each setting.

Flow

  1. App: Build a process in which the app server grants products when PG payment is made in the Web Shop. For related settings, see Payment notification settings.
  2. App server: When a user purchases a purchase quantity limit product in the Web Shop, call the Web Shop payment information validation API before granting the product.
  3. Hive server: Verifies whether the user order exceeds the product maximum purchase quantity, then sends the result to the app server as an API response.
  4. App server: Grant the product only when the API response passes the validation requirements. If the order exceeds the maximum purchase quantity, do not grant the product and cancel the payment. The Web Shop reflects the quantity as sold and decreases the remaining quantity only when validation has no issues. If the API response indicates an invalid payment, the app server must not grant the product to the user and must cancel the payment.
Warning

If steps 2 and 4 above are not implemented, the purchase quantity limit configured in Hive Console Web Shop will not work properly. In that case, the Web Shop assumes no quantity has been sold, so the displayed remaining quantity does not decrease. This means the product can continue to be purchased.

Note

For details about payment cancellation, see Grant result processing.


Web Shop payment information validation API

Validates whether the payment is valid based on completed Web PG payment information, including whether the product exceeds the maximum purchase quantity.

Request information

Category Info
Production URL https://shop.withhive.com/api/v2/webstore/check-quantity-limit
SANDBOX URL https://sandbox-shop.withhive.com/api/v2/webstore/check-quantity-limit
HTTP Method POST
Data Format JSON

Request header

Field Description Type Required Notes
Content-Type application/json String Y
X-Access-Token OAuth 2.0 Access Token for app server authentication
(OAuth Token issuance)
String Y

Request header sample

Content-Type : application/json
X-Access-Token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InByb2plY3RfYWJjMTIzIn0.eyJwcm9qZWN0X2lkIjoiY29tLmNvbTJ1cy5leGFtcGxlIiwidG9rZW5fdHlwZSI6ImFjY2Vzc190b2tlbiIsImdyYW50X3R5cGUiOiJwcm9qZWN0IiwiaWF0IjoxNzE1NTg0MDAwLCJleHAiOjE3MTU1ODc2MDAsImF1dGhfdmVyIjoidjQiLCJ1c2VyX2lkIjoiIiwiaXNfd2hpdGVsaXN0Ijp0cnVlfQ.signature

Request body

Field Description Type Required
type Notification type (paid: payment completed, cancelled: payment cancellation or refund) String Y
market_pid Product ID String Y
order_id Order number String Y
server_id App server identification code accessed by the purchasing user String Y
appid Web Shop App ID of the app; the App ID where the market_pid above is registered String Y
cs_code Player ID of the purchasing user String Y
paid_datetime Payment completion time (Y-m-d H:i:s) String Y
quantity Purchase quantity String Y
iap_payload Additional account information for item grant by the app server String Y

Request body sample

{
  "type": "paid",
  "market_pid": "com.com2us.hivesdk.windows.microsoftstore.global.normal.item01",
  "order_id": "H3175513391360875943",
  "server_id": "1",
  "appid": "com.com2us.hivesdk.windows.hivepc",
  "cs_code": "20000023100",
  "paid_datetime": "2025-08-14 10:12:18",
  "quantity": "10",
  "iap_payload": "{"cs_code":20000023100,"data":{"server_id":"1","server_name":"Server 1","channels":{"channel_id":"11","channel_name":"Channel 11","characters":{"character_id":"111","character_name":"Character 111"}}}}"
}

Response body

Field Description Type
result_code Response result code Integer
result_msg Response result message String
token_validation JWT validation result (JWT validation error codes) Object
token_validation.result_code JWT validation result code Integer
token_validation.result_msg JWT validation result message String
  • Products should be granted normally only for result_code responses 100 and 101.
  • result_code 3001 is an already validated order. Grant the product only if it was not granted previously.
  • result_code 3002 means the product maximum purchase quantity was exceeded. You must cancel the payment for that order. For details, see Grant result processing.

Response body sample

Success
{
  "result_code": 100,
  "result_msg": "success",
  "token_validation": {
    "result_code": 0,
    "result_msg": "success"
  }
}
JWT validation failure
{
  "result_code": 2499,
  "result_msg": "JWT validation failed. See token_validation for details.",
  "token_validation": {
    "result_code": 2408,
    "result_msg": "The access token is expired. Please refresh your token."
  }
}
Note

When JWT validation fails, you can check detailed error information through the token_validation field. For details, see JWT validation error codes.

Response code

code msg description
100 success Success
101 success(product no limit) Success (product without quantity limit; no separate validation required)
3001 fail(already completed) Already validated order number reflected in quantity. If the product was already granted, no additional grant is needed.
3002 fail(purchase fail, purchase cancellation required) Failed (quantity limit exceeded). If a product whose quantity limit is already exceeded was purchased, payment cancellation is required.
2499 fail(JWT validation failed. See token_validation for details.) JWT validation failed (see token_validation: JWT validation error codes)
2000 fail(method error) Invalid HTTP METHOD
2001 fail(request parameter error) Request parameter does not exist
2002 fail(type parameter error) Invalid parameter (type)
2003 fail(market_pid parameter error) Invalid parameter (market_pid)
2004 fail(order_id parameter error) Invalid parameter (order_id)
2005 fail(server_id parameter error) Invalid parameter (server_id)
2006 fail(appid parameter error) Invalid parameter (appid)
2007 fail(cs_code parameter error) Invalid parameter (cs_code)
2008 fail(paid_datetime parameter error) Invalid parameter (paid_datetime)
2009 fail(quantity parameter error) Invalid parameter (quantity)
2010 fail(iap_payload parameter error) Invalid parameter (iap_payload)
500 fail(appid in DB not exist) App information matching the App ID does not exist
501 fail(gameprefix not exist) Failed to retrieve Web Shop information matching the App ID. Create the Web Shop first.
502 fail(####) Other #### error occurred
503 fail(product info in DB not exist) Product information matching the market_pid does not exist. Register the product first in Hive Console > Community & Web Shop > Web Shop > Product Management.
504 fail(####) Other #### error occurred
505 fail(temporary error : ####) Other temporary #### error occurred