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

# GS2-Money Transaction Actions

Specification of verify/consume/acquire transaction actions





## Consume Action



### Gs2Money:WithdrawByUserId

Consume balance from Wallet by User ID

Withdraws the specified amount of currency from the wallet for the specified user.
If paidOnly is false, free currency is consumed first, then paid currency.

**Quantity specification supported: YES**

**Reversible action: YES**

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128 chars | Namespace name<br>Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
| userId | string |  | ✓|  |  ~ 128 chars | User ID<br>Specify `#{userId}` to substitute the currently logged-in user's ID. |
| slot | int |  | ✓|  | 0 ~ 100000000 | Slot Number<br>An identifier for separating wallet balances by platform or context.<br>Different slots allow managing separate paid currency pools (e.g., iOS purchases in slot 0, Android in slot 1).<br>Free currency can optionally be shared across all slots via the Namespace's shareFree setting. |
| count | int |  | ✓|  | 1 ~ 2147483646 | Quantity of premium currency to be consumed |
| paidOnly | bool |  | | false |  | Whether to target only paid currency |
| timeOffsetToken | string |  | |  |  ~ 1024 chars | Time offset token |




**JSON**
```json
{
    "action": "Gs2Money:WithdrawByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "slot": "[int]Slot Number",
        "count": "[int]Quantity of premium currency to be consumed",
        "paidOnly": "[bool]Whether to target only paid currency",
        "timeOffsetToken": "[string]Time offset token"
    }
}
```

**YAML**
```yaml

action: Gs2Money:WithdrawByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  slot: "[int]Slot Number"
  count: "[int]Quantity of premium currency to be consumed"
  paidOnly: "[bool]Whether to target only paid currency"
  timeOffsetToken: "[string]Time offset token"
```

**GS2-Script**
```lua

transaction.service("money").consume.withdraw_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    slot="[int]Slot Number",
    count="[int]Quantity of premium currency to be consumed",
    paidOnly="[bool]Whether to target only paid currency",
    timeOffsetToken="[string]Time offset token",
})
```


---

### Gs2Money:RecordReceipt

Record receipt

Records and validates a purchase receipt from a store platform (Apple App Store / Google Play).
The receipt is verified against the platform's servers to prevent fraud. Duplicate receipts are rejected to prevent replay attacks.

**Quantity specification supported: NO**

**Reversible action: NO**

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128 chars | Namespace name<br>Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
| userId | string |  | ✓|  |  ~ 128 chars | User ID<br>Specify `#{userId}` to substitute the currently logged-in user's ID. |
| contentsId | string |  | ✓|  |  ~ 1024 chars | Content IDs sold on the store platform |
| receipt | string |  | ✓|  |  ~ 524288 chars | Receipt |
| timeOffsetToken | string |  | |  |  ~ 1024 chars | Time offset token |




**JSON**
```json
{
    "action": "Gs2Money:RecordReceipt",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "contentsId": "[string]Content IDs sold on the store platform",
        "receipt": "[string]Receipt",
        "timeOffsetToken": "[string]Time offset token"
    }
}
```

**YAML**
```yaml

action: Gs2Money:RecordReceipt
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  contentsId: "[string]Content IDs sold on the store platform"
  receipt: "[string]Receipt"
  timeOffsetToken: "[string]Time offset token"
```

**GS2-Script**
```lua

transaction.service("money").consume.record_receipt({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    contentsId="[string]Content IDs sold on the store platform",
    receipt="[string]Receipt",
    timeOffsetToken="[string]Time offset token",
})
```


---

## Acquire Action



### Gs2Money:DepositByUserId

Deposit balance to Wallet by User ID

Adds the specified amount of currency to the wallet for the specified user.
If the price is 0, it is treated as free currency; otherwise, it is treated as paid currency.

**Quantity specification supported: YES**

**Reversible action: YES**

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128 chars | Namespace name<br>Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
| userId | string |  | ✓|  |  ~ 128 chars | User ID<br>Specify `#{userId}` to substitute the currently logged-in user's ID. |
| slot | int |  | ✓|  | 0 ~ 100000000 | Slot Number<br>An identifier for separating wallet balances by platform or context.<br>Different slots allow managing separate paid currency pools (e.g., iOS purchases in slot 0, Android in slot 1).<br>Free currency can optionally be shared across all slots via the Namespace's shareFree setting. |
| price | float |  | ✓|  | 0 ~ 100000.0 | Purchase Price |
| count | int |  | ✓|  | 1 ~ 2147483646 | Quantity of premium currency to be granted |
| timeOffsetToken | string |  | |  |  ~ 1024 chars | Time offset token |




**JSON**
```json
{
    "action": "Gs2Money:DepositByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "slot": "[int]Slot Number",
        "price": "[float]Purchase Price",
        "count": "[int]Quantity of premium currency to be granted",
        "timeOffsetToken": "[string]Time offset token"
    }
}
```

**YAML**
```yaml

action: Gs2Money:DepositByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  slot: "[int]Slot Number"
  price: "[float]Purchase Price"
  count: "[int]Quantity of premium currency to be granted"
  timeOffsetToken: "[string]Time offset token"
```

**GS2-Script**
```lua

transaction.service("money").acquire.deposit_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    slot="[int]Slot Number",
    price="[float]Purchase Price",
    count="[int]Quantity of premium currency to be granted",
    timeOffsetToken="[string]Time offset token",
})
```


---

### Gs2Money:RevertRecordReceipt

Delete receipt record by User ID

Reverts a previously recorded receipt by extracting the transaction ID and deleting the corresponding record.
Used for handling refunds or chargebacks from the store platform.

**Quantity specification supported: NO**

**Reversible action: NO**

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128 chars | Namespace name<br>Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
| userId | string |  | ✓|  |  ~ 128 chars | User ID<br>Specify `#{userId}` to substitute the currently logged-in user's ID. |
| receipt | string |  | ✓|  |  ~ 524288 chars | Receipt |
| timeOffsetToken | string |  | |  |  ~ 1024 chars | Time offset token |




**JSON**
```json
{
    "action": "Gs2Money:RevertRecordReceipt",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "receipt": "[string]Receipt",
        "timeOffsetToken": "[string]Time offset token"
    }
}
```

**YAML**
```yaml

action: Gs2Money:RevertRecordReceipt
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  receipt: "[string]Receipt"
  timeOffsetToken: "[string]Time offset token"
```

**GS2-Script**
```lua

transaction.service("money").acquire.revert_record_receipt({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    receipt="[string]Receipt",
    timeOffsetToken="[string]Time offset token",
})
```


---



