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

# GS2-LoginReward Script Trigger Reference

Reference for event triggers that call extended scripts



## Trigger

### receive

Receiving rewards

**Related methods:**
receive - Receive Login Bonus


#### Synchronous Execution Script

The script is executed synchronously before the receiving rewards process.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| bonusModel | [BonusModel](../sdk/#bonusmodel) | Login Bonus Model |
| userId | string | User ID performing the loginReward |
| receiveStep | int | Received step |
| config | [Config[]](../sdk/#config) | Configuration values applied to transaction variables |

##### Result

|  | Type | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | Whether to allow receiving the reward |

##### Implementation Example


**Lua**
```lua

-- Request
local namespace = args.namespace
local bonusModel = args.bonusModel
local userId = args.userId
local receiveStep = args.receiveStep
local config = args.config

-- Business logic:
local permit = true

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


#### Asynchronous Execution Script

The script is executed asynchronously after the receiving rewards process.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| bonusModel | [BonusModel](../sdk/#bonusmodel) | Login Bonus Model |
| userId | string | User ID performing the loginReward |
| receiveStep | int | Received step |
| config | [Config[]](../sdk/#config) | Configuration values applied to transaction variables |


##### Implementation Example


**Lua**
```lua

-- Request
local namespace = args.namespace
local bonusModel = args.bonusModel
local userId = args.userId
local receiveStep = args.receiveStep
local config = args.config

-- Asynchronous scripts typically do not affect the API response.
-- These scripts are typically used for logging, analytics, external notifications, and similar purposes.

result = {
}
```


---
  



