GS2-Showcase Script Trigger Reference
Reference of event triggers that call extended scripts
Trigger
buy
Buy
Synchronous Execution Script
The script is executed synchronously before the buy process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| showcase | Showcase | Showcase model |
| displayItem | DisplayItem | DisplayItem model |
| userId | string | User ID performing the showcase |
| quantity | int | Purchase Quantity |
| config | Config[] | Set values to be applied to transaction variables |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow buy |
Implementation Example
-- 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
}Asynchronous Execution Script
The script is executed asynchronously after the buy process.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| showcase | Showcase | Showcase model |
| displayItem | DisplayItem | DisplayItem model |
| userId | string | User ID performing the showcase |
| quantity | int | Purchase Quantity |
| config | Config[] | Set values to be applied to transaction variables |
Implementation Example
-- 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
-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.
result = {
}