GS2-Showcase Script トリガー リファレンス

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

トリガー

buy

購入

同期実行スクリプト

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

Request
説明
namespace Namespace ネームスペース
showcase Showcase 陳列棚モデル
displayItem DisplayItem 陳列商品モデル
userId string 購入を実行しているユーザーID
quantity int 購入量
config Config[] トランザクションの変数に適用する設定値
Result
必須 デフォルト 値の制限 説明
permit bool
購入を許可するか
実装例
-- 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 ネームスペース
showcase Showcase 陳列棚モデル
displayItem DisplayItem 陳列商品モデル
userId string 購入を実行しているユーザーID
quantity int 購入量
config Config[] トランザクションの変数に適用する設定値
実装例
-- 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 = {
}