> For the complete documentation index, see [llms.txt](https://onestore-dev.gitbook.io/dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onestore-dev.gitbook.io/dev/chi/tools/webshop/validation.md).

# 有效性验证

用于验证用户输入的游戏 ID 和服务器信息是否有效，并确认道具是否可购买。

* 游戏 ID 是用于标识最终接收道具的对象（用户或角色）的值。在网页商店中，该值以 `serviceUserId` 的形式传递。*<mark style="color:$info;">(根据游戏结构，该值可作为 UID 或角色 ID 使用。)</mark>*

#### **Request URI**

{% hint style="warning" %}
**注意事项**\
根据 ONE webshop 的安全策略，**仅支持 HTTPS 协议及 443 端口**，使用其他规格可能无法正常运行。
{% endhint %}

<table data-header-hidden><thead><tr><th width="184.9678955078125"></th><th></th></tr></thead><tbody><tr><td><strong>HTTP Type</strong></td><td>HTTPS</td></tr><tr><td><strong>HTTP Method</strong></td><td><mark style="color:$primary;"><code>POST</code></mark></td></tr><tr><td><strong>URL</strong></td><td>可在 <code>Developer Center > Webshop > Integration Mgmt.</code> 中注册要接收通知的服务器 URL。<br>详细设置方法请参考《<a href="/pages/N0EqKOKMSm8CJ3EVdrDg">Integration Management Guide</a>》。</td></tr><tr><td><strong>Header</strong></td><td><p>Content-Type: application/json; charset=UTF-8</p><p>Accept: application/json</p></td></tr></tbody></table>

#### **Request**

<table><thead><tr><th width="203.33251953125">Name</th><th width="133.9879150390625">Type</th><th width="127.109375">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>param.clientId</code></td><td>String</td><td>M</td><td>ONE webshop 标题 ID（商品 ID）</td></tr><tr><td><code>param.prodId</code></td><td>String</td><td>M</td><td>ONE webshop 道具ID(In-App 商品 ID)</td></tr><tr><td><code>param.serviceUserId</code></td><td>String</td><td>M</td><td>用户游戏 ID</td></tr><tr><td><code>param.serviceServerId</code></td><td>String</td><td>Optional</td><td>用户服务器 ID<br><mark style="color:$danger;">※ 当 Purchase Input Information = “Purchase Identifier + Server” 时为必填。</mark></td></tr><tr><td><code>signature</code></td><td>String</td><td>M</td><td><p>用于防止篡改的签名 (License Key)</p><ul><li>使用下面的指南，您可以检查 signature 是否被强制生成或伪造。<br>签名密钥可在 <code>Developer Center > Integration Mgmt. > Settings for Licensing</code> 菜单中查看</li><li>Guide : <a href="https://onestore-dev.gitbook.io/dev/chi/tools/webshop/billing#id-shi-yong-pnspushnotificationservicesignature-yan-zheng-fang-fa">Signatue验证方法</a> </li></ul></td></tr></tbody></table>

**Example**

```
curl -X POST \
  'https://example.com/gameuser/check' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "param": {
      "clientId": "WS00000001",
      "prodId": "item1000",
      "serviceUserId": "USR1234567890",
      "serviceServerId": "asia01"
    },
    "signature": "ajkfl;askfjkladfjksl"
  }'
```

#### **Response**

<table><thead><tr><th width="203.33251953125">Name</th><th width="133.9879150390625">Type</th><th width="127.109375">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><code>result.code</code></td><td>String</td><td>M</td><td>"0000"：成功<br>"1000"：非会员<br>"1001"：不可购买</td></tr><tr><td><code>result.message</code></td><td>String</td><td>M</td><td><ul><li>当 <code>result.code</code> 为 <code>1001</code> 时，该消息将显示给用户。</li><li>建议以适合目标用户的语言提供该消息。</li><li><p><strong>示例消息</strong></p><ul><li>"구매 가능한 횟수를 초과하였습니다."(已超过可购买次数。)</li><li>"이미 구매한 상품입니다."(该商品已购买。)</li><li>"이벤트 기간이 종료된 상품입니다."(该商品的活动时间已结束。)</li></ul></li></ul></td></tr><tr><td><code>developerPayload</code></td><td>String</td><td>Optional</td><td><p>开发者在有效性验证响应中传递的购买标识。</p><ul><li>该值也会在支付完成后的 PNS 中包含，用于购买验证。</li></ul></td></tr></tbody></table>

**Example**

```
// 成功
{
  "result": {
    "code": "0000",
    "message": "User found"
  },
  "developerPayload": "OS_000211234" //Optional
}

// 非会员
{
  "result": {
    "code": "1000",
    "message": "User not found"
  }
}

//不可购买
{
  "result": {
    "code": "1001",
    "message": "구매 가능한 횟수를 초과하였습니다." //已超过可购买次数。
  }
}
```
