GS2-SerialKey Transaction Actions

Specification of verify/consume/acquire transaction actions

Verify Action

Gs2SerialKey:VerifyCodeByUserId

Verify the validity of the Serial Code by specifying a user ID

Verifies a serial code for the specified user without consuming it. Supports verification against a specific campaign model name, and can check whether the code is active (unused) or inactive (already used).

Supports quantity specification: NO

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Specify #{userId} to substitute the currently logged-in user’s ID.
codestring
~ 48 charsSerial Code
The serial code string in the format “XXXXX-XXXX-XXXXX-XXXX-XXXX”. Each code is unique and includes campaign identification information. The code format and data length are fixed and cannot be changed.
campaignModelNamestring~ 128 charsCampaign name
The name of the campaign model this serial code belongs to. Campaign information is embedded within the serial code itself, so only the namespace needs to be specified when using the code.
verifyTypeString Enum
enum {
  “active”,
  “inactive”
}
Verification type
DefinitionDescription
“active”Active
“inactive”Inactive
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2SerialKey:VerifyCodeByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "code": "[string]Serial Code",
        "campaignModelName": "[string]Campaign name",
        "verifyType": "[string]Verification type",
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2SerialKey:VerifyCodeByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  code: "[string]Serial Code"
  campaignModelName: "[string]Campaign name"
  verifyType: "[string]Verification type"
  timeOffsetToken: "[string]Time offset token"
transaction.service("serialKey").verify.verify_code_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    code="[string]Serial Code",
    campaignModelName="[string]Campaign name",
    verifyType="[string]Verification type",
    timeOffsetToken="[string]Time offset token",
})

Consume Action

Gs2SerialKey:UseByUserId

Using Serial Code by specifying a user ID

Marks a serial code as used by the specified user. Validates that the code exists and has not already been used.

Supports quantity specification: NO

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
Specify #{userId} to substitute the currently logged-in user’s ID.
codestring
~ 48 charsSerial Code
The serial code string in the format “XXXXX-XXXX-XXXXX-XXXX-XXXX”. Each code is unique and includes campaign identification information. The code format and data length are fixed and cannot be changed.
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2SerialKey:UseByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "code": "[string]Serial Code",
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2SerialKey:UseByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  code: "[string]Serial Code"
  timeOffsetToken: "[string]Time offset token"
transaction.service("serialKey").consume.use_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    code="[string]Serial Code",
    timeOffsetToken="[string]Time offset token",
})

Acquire Action

Gs2SerialKey:RevertUseByUserId

Serial Code set to unused by specifying a user ID

Reverts a used serial code back to unused status. Validates that the code is currently in used state before reverting.

Supports quantity specification: NO

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
Specify #{userId} to substitute the currently logged-in user’s ID.
codestring
~ 48 charsSerial Code
The serial code string in the format “XXXXX-XXXX-XXXXX-XXXX-XXXX”. Each code is unique and includes campaign identification information. The code format and data length are fixed and cannot be changed.
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2SerialKey:RevertUseByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "code": "[string]Serial Code",
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2SerialKey:RevertUseByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  code: "[string]Serial Code"
  timeOffsetToken: "[string]Time offset token"
transaction.service("serialKey").acquire.revert_use_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    code="[string]Serial Code",
    timeOffsetToken="[string]Time offset token",
})

Gs2SerialKey:IssueOnce

Issue a serial code

Issues a single serial code immediately. The code is generated using AES encryption and base32 encoding in the format XXXXX-XXXX-XXXXX-XXXX-XXXXX. Unlike batch issuance jobs, this generates and returns a code synchronously.

Supports quantity specification: NO

Whether the action is reversible: NO

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
campaignModelNamestring
~ 128 charsCampaign Model name
metadatastring~ 2048 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
{
    "action": "Gs2SerialKey:IssueOnce",
    "request": {
        "namespaceName": "[string]Namespace name",
        "campaignModelName": "[string]Campaign Model name",
        "metadata": "[string]Metadata"
    }
}
action: Gs2SerialKey:IssueOnce
request:
  namespaceName: "[string]Namespace name"
  campaignModelName: "[string]Campaign Model name"
  metadata: "[string]Metadata"
transaction.service("serialKey").acquire.issue_once({
    namespaceName="[string]Namespace name",
    campaignModelName="[string]Campaign Model name",
    metadata="[string]Metadata",
})