GS2-AdReward Transaction Actions

Specification of verify/consume/acquire transaction actions

ConsumeAction

Gs2AdReward:ConsumePointByUserId

Consume Points by specifying a user ID

Subtracts a specified number of points from the specified user ID and returns the updated point information. An error is returned if the user does not have enough points to cover the requested consumption amount. If a GS2-Script is configured in the namespace’s consume script settings, the script is executed before the point deduction, allowing custom validation or modification of the consume amount. After the point deduction, a change notification is sent if configured in the namespace settings.

Supports quantity specification: YES

Whether the action is reversible: YES

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Set #{userId} to replace the currently logged in user ID.
pointlong
1 ~ 9223372036854775805Consume Points
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2AdReward:ConsumePointByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "point": "[long]Consume Points",
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2AdReward:ConsumePointByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  point: "[long]Consume Points"
  timeOffsetToken: "[string]Time offset token"
transaction.service("adReward").consume.consume_point_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    point="[long]Consume Points",
    timeOffsetToken="[string]Time offset token",
})

AcquireAction

Gs2AdReward:AcquirePointByUserId

Acquire Points by specifying a user ID

Adds a specified number of points to the specified user ID and returns the updated point information. If the user has no existing point record, a new record is automatically created before adding points. If a GS2-Script is configured in the namespace’s acquire script settings, the script is executed before the point addition, allowing custom validation or modification of the acquire amount. After the point addition, a change notification is sent if configured in the namespace settings.

Supports quantity specification: YES

Whether the action is reversible: YES

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Set #{userId} to replace the currently logged in user ID.
pointlong
1 ~ 9223372036854775805Acquire Points
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2AdReward:AcquirePointByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "point": "[long]Acquire Points",
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2AdReward:AcquirePointByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  point: "[long]Acquire Points"
  timeOffsetToken: "[string]Time offset token"
transaction.service("adReward").acquire.acquire_point_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    point="[long]Acquire Points",
    timeOffsetToken="[string]Time offset token",
})