Skip to content

Web shop purchase limit validation

Hive Console > Community & Web Shop > Web Shop > Product Management lets you set a per-account purchase limit and a purchase quantity limit for each web shop product. For each of these settings you can configure the maximum purchase quantity.

Web store purchase limit validation checks whether the purchased product in the web shop exceeds the maximum purchase quantity defined by those two settings. For this task, the Web store payment information validation API is provided.

Overview

The overall flow of web store purchase limit validation, including calling the Web store payment information validation API, is summarized below.

  1. Game developer: Build the process that grants the product to the user when a PG (Payment Gateway) payment is made in the web store, referring to Implementing PG payment and PG configuration.
  2. Game developer: When a user purchases a product that has a per-account purchase limit and/or purchase quantity limit in the web store, call the Web store payment information validation API before granting the product.
  3. Hive server: Validates whether the order exceeds the product's maximum purchase quantity. After validation, returns the result to the developer server as the API response.
  4. Game developer: Only grant the product if the validation conditions (e.g., not exceeding the maximum purchase quantity) are satisfied. If the order exceeded the maximum purchase quantity, do not grant the product and perform a payment cancellation. The web store only reflects the purchased quantity and decreases the remaining quantity when the validation passes. If the API response indicates the payment is invalid, the developer server must NOT grant the product and must cancel the payment.
Warning

If steps 2 and 4 are not implemented, the per-account purchase limit and purchase quantity limit features configured in the Hive Console web shop will not function properly. In that case, the web shop assumes no quantity has yet been sold, so the displayed remaining quantity will not decrease. This means the product can continue to be purchased indefinitely.

Note

For details about payment cancellation, see Grant result processing.

Web store payment information validation API

Validates whether the payment (based on completed web PG payment info) is valid, including whether the maximum purchase quantity for the product has been exceeded.

Request information

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

Request header

Field Description Type Required Notes
Content-Type application/json String Y
Authorization Bearer token String Y App Center > Project Management > Game Detail > Basic Info > Hive Certification Key

Request header sample

Content-Type : application/json
Authorization : Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAyMDU2NzI2LCJqdGkiOiIxODczMTExMzIwIn0.3soFiHTPlObCoqR5xX9ZeOQTSvnHrHDHWmopP3QfWtY

Request body

Field Description Type Required
type Notification type (paid: payment completed, cancelled: payment cancelled or refunded) String Y
market_pid Product unique ID String Y
order_id Order number String Y
server_id Code of the game server the buyer connected to String Y
appid Web store AppID in which the above market_pid is registered String Y
cs_code PlayerID of the purchasing user String Y
paid_datetime Time the payment completed (Y-m-d H:i:s) String Y
quantity Purchase quantity String Y
iap_payload Additional account information for granting the product on the game 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
code Response result code Integer
msg Response result message String
  • Only for responses 100, 101 should the product be granted.
  • 3001 means the order has already been validated. Grant the product only if it was not granted previously.
  • 3002 means the product's maximum purchase quantity was exceeded. You must cancel the payment. See Grant result processing for details.

Response body sample

{
    "code": 100,
    "msg": "success"
}

Response codes

Below are the specifications for the response codes (code).

code msg description
100 success Success
101 success(product no limit) Success (product has no quantity limit; no validation needed)
2000 fail(method error) Request used an invalid HTTP METHOD
2001 fail(request parameter error) Required request parameter missing
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)
2011 fail(hiveCertificationKey parameter error) Invalid parameter (hiveCertificationKey)
3000 fail(hiveCertificationKey invalid) Hive certification key validation failed
3001 fail(already completed) ⚠️ Order number already validated and reflected in quantity.
No additional grant if product already granted
3002 fail(purchase fail, purchase cancellation required) ⚠️ Failed (quantity limit exceeded)
Product exceeded quantity limit; payment cancellation required
500 fail(appid in DB not exist) No game info matched to appId
501 fail(gameprefix not exist) Failed to retrieve web store info for appId
Create web store first (Community or Web Store must exist)
502 fail(####) Other "####" error occurred
503 fail(product info in DB not exist) No product info matched to market_pid
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