> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Showcase スクリプト トリガー リファレンス

拡張スクリプトを呼び出すイベントトリガーのリファレンス



## トリガー

### buy

購入
**関連するメソッド:**
buy - 商品を購入


#### 同期実行スクリプト

購入処理の前に、スクリプトが同期実行されます。

##### Request

| | 型 | 説明 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | ネームスペース |
| showcase | [Showcase](../sdk/#showcase) | 陳列棚モデル |
| displayItem | [DisplayItem](../sdk/#displayitem) | 陳列商品モデル |
| userId | string | 購入を実行しているユーザーID |
| quantity | int | 購入量 |
| config | [Config[]](../sdk/#config) | トランザクションの変数に適用する設定値 |

##### Result

|  | 型 | 必須 | デフォルト | 値の制限 | 説明 |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | 購入を許可するか |

##### 実装例


**Lua**
```lua

-- Request
local namespace = args.namespace
local showcase = args.showcase
local displayItem = args.displayItem
local userId = args.userId
local quantity = args.quantity
local config = args.config

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}
```


#### 非同期実行スクリプト

購入処理の後に、スクリプトが非同期実行されます。

##### Request

| | 型 | 説明 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | ネームスペース |
| showcase | [Showcase](../sdk/#showcase) | 陳列棚モデル |
| displayItem | [DisplayItem](../sdk/#displayitem) | 陳列商品モデル |
| userId | string | 購入を実行しているユーザーID |
| quantity | int | 購入量 |
| config | [Config[]](../sdk/#config) | トランザクションの変数に適用する設定値 |


##### 実装例


**Lua**
```lua

-- Request
local namespace = args.namespace
local showcase = args.showcase
local displayItem = args.displayItem
local userId = args.userId
local quantity = args.quantity
local config = args.config

-- 非同期スクリプトは通常、API のレスポンスには影響を与えません。
-- ログ出力や分析、外部通知などに使用します。

result = {
}
```


---
  



