GS2-Money SDK API Reference
Model
Namespace
Namespace
A Namespace allows multiple independent instances of the same service within a single project by separating data spaces and usage contexts. Each GS2 service is managed on a per-namespace basis. Even when using the same service, if the namespace differs, the data is treated as a completely independent data space.
Therefore, you must create a namespace before you can start using each service.
| Type | Condition | Required | Default | Value Limits | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceId | string | * | ~ 1024 chars | Namespace GRN * Set automatically by the server | ||||||||||
| name | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||||||||||
| description | string | ~ 1024 chars | Description | |||||||||||
| transactionSetting | TransactionSetting | Transaction Setting | ||||||||||||
| priority | String Enum enum { “free”, “paid” } | ✓ | Consumption priority
| |||||||||||
| shareFree | bool | ✓ | Share the free currency across multiple wallet slots | |||||||||||
| currency | String Enum enum { “JPY”, “USD”, “TWD” } | ✓ | Currency Type
| |||||||||||
| appleKey | string | ~ 1024 chars | Apple AppStore Bundle ID | |||||||||||
| googleKey | string | ~ 5120 chars | Google PlayStore private key | |||||||||||
| enableFakeReceipt | bool | false | Whether to allow payments using fake receipts output by UnityEditor | |||||||||||
| createWalletScript | ScriptSetting | Script to run when a new wallet is created | ||||||||||||
| depositScript | ScriptSetting | Script setting to be executed when the wallet balance is added | ||||||||||||
| withdrawScript | ScriptSetting | Script setting to be executed when wallet balance is consumed | ||||||||||||
| balance | double | 0.0 | 0 ~ 281474976710653 | Unused balance | ||||||||||
| logSetting | LogSetting | Log Output Setting | ||||||||||||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||||||||||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||||||||||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
TransactionSetting
Transaction Setting
Transaction Setting controls how transactions are executed, including their consistency, asynchronous processing, and conflict avoidance mechanisms. Combining features like AutoRun, AtomicCommit, asynchronous execution using GS2-Distributor, batch application of script results, and asynchronous Acquire Actions via GS2-JobQueue enables robust transaction management tailored to game logic.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| enableAutoRun | bool | false | Whether to automatically execute issued transactions on the server side | |||
| enableAtomicCommit | bool | {enableAutoRun} == true | false | Whether to commit the execution of transactions atomically * Applicable only if enableAutoRun is true | ||
| transactionUseDistributor | bool | {enableAtomicCommit} == true | false | Whether to execute transactions asynchronously * Applicable only if enableAtomicCommit is true | ||
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true | false | Whether to execute the commit processing of the script result asynchronously * Applicable only if transactionUseDistributor is true | ||
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | false | Whether to use GS2-JobQueue to execute the acquire action * Applicable only if enableAtomicCommit is true | ||
| distributorNamespaceId | string | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024 chars | GS2-Distributor Namespace GRN used to execute transactions | ||
| queueNamespaceId | string | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024 chars | GS2-JobQueue Namespace GRN used to execute transactions |
ScriptSetting
Script Setting
In GS2, you can associate custom scripts with microservice events and execute them. This model holds the settings for triggering script execution.
There are two main ways to execute a script: synchronous execution and asynchronous execution. Synchronous execution blocks processing until the script has finished executing. Instead, you can use the script’s execution results to halt API execution or control the API’s response content.
In contrast, asynchronous execution does not block processing until the script has finished executing. However, because the script result cannot be used to stop the API execution or modify the API response, asynchronous execution does not affect the API response flow and is generally recommended.
There are two types of asynchronous execution methods: GS2-Script and Amazon EventBridge. By using Amazon EventBridge, you can write processing in languages other than Lua.
| Type | Condition | Required | Default | Value Limits | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| triggerScriptId | string | ~ 1024 chars | GS2-Script script GRN
executed synchronously when the API is executed Must be specified in GRN format starting with “grn:gs2:”. | |||||||||||
| doneTriggerTargetType | String Enum enum { “none”, “gs2_script”, “aws” } | “none” | How to execute asynchronous scripts Specifies the type of script to use for asynchronous execution. You can choose from “Do not use asynchronous execution scripts (none)”, “Use GS2-Script (gs2_script)”, and “Use Amazon EventBridge (aws)”.
| |||||||||||
| doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | GS2-Script script GRN
for asynchronous execution Must be specified in GRN format starting with “grn:gs2:”. * Applicable only if doneTriggerTargetType is “gs2_script” | ||||||||||
| doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | GS2-JobQueue namespace GRN
to execute asynchronous execution scripts If you want to execute asynchronous execution scripts via GS2-JobQueue instead of executing them directly, specify the GS2-JobQueue namespace GRN. There are not many cases where GS2-JobQueue is required, so you generally do not need to specify it unless you have a specific reason. * Applicable only if doneTriggerTargetType is “gs2_script” |
LogSetting
Log Output Setting
Log Output Setting defines how log data is exported. This type holds the GS2-Log namespace identifier (Namespace ID) used to export log data. Specify the GS2-Log namespace where log data is collected and stored in the GRN format for the Log Namespace ID (loggingNamespaceId). Configuring this setting ensures that log data for API requests and responses occurring within the specified namespace is output to the target GS2-Log namespace. GS2-Log provides real-time logs that can be used for system monitoring, analysis, debugging, and other operational purposes.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024 chars | GS2-Log namespace GRN
to output logs Must be specified in GRN format starting with “grn:gs2:”. |
Wallet
Wallet
Currency in the wallet is managed separately for currency purchased for a fee and currency obtained for free. Currency purchased for a fee is further managed by the unit price at the time of purchase, allowing for refunds in the event of service termination, or to determine if the balance is sufficient to meet the requirements of the Funds Settlement Act.
The wallet has slots and each slot has a different balance. If balances cannot be shared across platforms, they can be managed separately by using different slots for each platform. Currency acquired for free can also be shared across all platforms.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| walletId | string | * | ~ 1024 chars | Wallet GRN * Set automatically by the server | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| slot | int | ✓ | 0 ~ 100000000 | Slot Number | ||
| paid | int | 0 | 0 ~ 2147483646 | Amount of paid currency possession | ||
| free | int | 0 | 0 ~ 2147483646 | Amount of free currency possession | ||
| detail | List<WalletDetail> | [] | 0 ~ 1000 items | List of Wallet Details | ||
| shareFree | bool | false | Share free currency | |||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
Receipt
Receipt
Receipts are entities that record payment history. Payment history includes not only requests for increases or decreases in billing currency, but also the history of payment transactions on various delivery platforms.
| Type | Condition | Required | Default | Value Limits | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| receiptId | string | * | ~ 1024 chars | Receipt GRN * Set automatically by the server | ||||||||||
| transactionId | string | ✓ | ~ 1024 chars | Transaction ID | ||||||||||
| purchaseToken | string | ~ 4096 chars | purchaseToken in Google Play payments | |||||||||||
| userId | string | ✓ | ~ 128 chars | User ID | ||||||||||
| type | String Enum enum { “purchase”, “deposit”, “withdraw” } | ✓ | Type
| |||||||||||
| slot | int | {type} != “purchase” | ✓* | 0 ~ 100000000 | Slot Number | |||||||||
| price | float | {type} != “purchase” | ✓* | 0 ~ 100000.0 | Unit Price | |||||||||
| paid | int | {type} != “purchase” | ✓* | 0 ~ 2147483646 | Paid currency | |||||||||
| free | int | {type} != “purchase” | ✓* | 0 ~ 2147483646 | Free currency | |||||||||
| total | int | {type} != “purchase” | ✓* | 0 ~ 2147483646 | Total | |||||||||
| contentsId | string | {type} == “purchase” | ~ 1024 chars | Content IDs sold on the store platform * Applicable only if type is “purchase” | ||||||||||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||||||||||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
WalletDetail
Wallet Detail
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| price | float | ✓ | 0 ~ 100000.0 | Unit Price | ||
| count | int | ✓ | 0 ~ 2147483646 | Count |
Methods
describeNamespaces
Get a list of Namespaces
Retrieves a list of namespaces that have been created on a per-service basis within the project. You can use the optional page token to start acquiring data from a specific location in the list. You can also limit the number of namespaces to be acquired.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namePrefix | string | ~ 64 chars | Filter by Namespace name prefix | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve |
Result
| Type | Description | |
|---|---|---|
| items | List<Namespace> | List of Namespace |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&money.DescribeNamespacesRequest {
NamePrefix: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokencreateNamespace
Create a new Namespace
You must specify detailed information including the name, description, and various settings of the namespace.
Request
| Type | Condition | Required | Default | Value Limits | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||||||||||
| description | string | ~ 1024 chars | Description | |||||||||||
| transactionSetting | TransactionSetting | Transaction Setting | ||||||||||||
| priority | String Enum enum { “free”, “paid” } | ✓ | Consumption priority
| |||||||||||
| shareFree | bool | ✓ | Share the free currency across multiple wallet slots | |||||||||||
| currency | String Enum enum { “JPY”, “USD”, “TWD” } | ✓ | Currency Type
| |||||||||||
| appleKey | string | ~ 1024 chars | Apple AppStore Bundle ID | |||||||||||
| googleKey | string | ~ 5120 chars | Google PlayStore private key | |||||||||||
| enableFakeReceipt | bool | false | Whether to allow payments using fake receipts output by UnityEditor | |||||||||||
| createWalletScript | ScriptSetting | Script to run when a new wallet is created | ||||||||||||
| depositScript | ScriptSetting | Script setting to be executed when the wallet balance is added | ||||||||||||
| withdrawScript | ScriptSetting | Script setting to be executed when wallet balance is consumed | ||||||||||||
| logSetting | LogSetting | Log Output Setting |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace created |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&money.CreateNamespaceRequest {
Name: pointy.String("namespace-0001"),
Description: nil,
TransactionSetting: nil,
Priority: pointy.String("paid"),
ShareFree: pointy.Bool(false),
Currency: pointy.String("USD"),
AppleKey: nil,
GoogleKey: nil,
EnableFakeReceipt: nil,
CreateWalletScript: nil,
DepositScript: nil,
WithdrawScript: nil,
LogSetting: &money.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.ItemgetNamespaceStatus
Get Namespace status
Get the current status of the specified namespace. This includes whether the Namespace is active, pending, or in some other state.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| status | string |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&money.GetNamespaceStatusRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
status := result.StatusgetNamespace
Get namespace
Get detailed information about the specified namespace. This includes the name, description, and other settings of the namespace.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&money.GetNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.ItemupdateNamespace
Update Namespace
Update the settings of the specified namespace. You can change the description of the Namespace and specific settings.
Request
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||||||||
| description | string | ~ 1024 chars | Description | |||||||||
| transactionSetting | TransactionSetting | Transaction Setting | ||||||||||
| priority | String Enum enum { “free”, “paid” } | ✓ | Consumption priority
| |||||||||
| appleKey | string | ~ 1024 chars | Apple AppStore Bundle ID | |||||||||
| googleKey | string | ~ 5120 chars | Google PlayStore private key | |||||||||
| enableFakeReceipt | bool | false | Whether to allow payments using fake receipts output by UnityEditor | |||||||||
| createWalletScript | ScriptSetting | Script to run when a new wallet is created | ||||||||||
| depositScript | ScriptSetting | Script setting to be executed when the wallet balance is added | ||||||||||
| withdrawScript | ScriptSetting | Script setting to be executed when wallet balance is consumed | ||||||||||
| logSetting | LogSetting | Log Output Setting |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace updated |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&money.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
Description: pointy.String("description1"),
TransactionSetting: nil,
Priority: pointy.String("paid"),
AppleKey: pointy.String("io.gs2.sample"),
GoogleKey: pointy.String("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB"),
EnableFakeReceipt: nil,
CreateWalletScript: &money.ScriptSetting{
TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1001"),
DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1002"),
},
DepositScript: &money.ScriptSetting{
TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1003"),
DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1004"),
},
WithdrawScript: &money.ScriptSetting{
TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1005"),
DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace-0001:script:script-1006"),
},
LogSetting: &money.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.ItemdeleteNamespace
Delete Namespace
Delete the specified namespace. This operation is irreversible and all data associated with the deleted Namespace will be lost.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | The deleted Namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&money.DeleteNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.ItemgetServiceVersion
Get the microservice version
Request
Request parameters: None
Result
| Type | Description | |
|---|---|---|
| item | string | Version |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.GetServiceVersion(
&money.GetServiceVersionRequest {
}
)
if err != nil {
panic("error occurred")
}
item := result.ItemdumpUserDataByUserId
Dump data associated with the specified user ID
Can be used to meet legal requirements for the protection of personal information, or to back up or migrate data.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description |
|---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.DumpUserDataByUserId(
&money.DumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}checkDumpUserDataByUserId
Check if the dump of the data associated with the specified user ID is complete
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| url | string | URL of output data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
&money.CheckDumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.UrlcleanUserDataByUserId
Delete user data
Execute cleaning of data associated with the specified user ID This allows you to safely delete specific user data from the project.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description |
|---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.CleanUserDataByUserId(
&money.CleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}checkCleanUserDataByUserId
Check if the cleaning of the data associated with the specified user ID is complete
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description |
|---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
&money.CheckCleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}prepareImportUserDataByUserId
Execute import of data associated with the specified user ID
The data that can be used for import is limited to the data exported by GS2, and old data may fail to import. You can import data with a user ID different from the one you exported, but if the user ID is included in the payload of the user data, this may not be the case.
You can start the actual import process by uploading the exported zip file to the URL returned in the return value of this API and calling importUserDataByUserId.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| uploadToken | string | Token used to reflect results after upload |
| uploadUrl | string | URL used to upload user data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
&money.PrepareImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrlimportUserDataByUserId
Execute import of data associated with the specified user ID
The data that can be used for import is limited to the data exported by GS2, and old data may fail to import. You can import data with a user ID different from the one you exported, but if the user ID is included in the payload of the user data, this may not be the case.
Before calling this API, you must call prepareImportUserDataByUserId to complete the upload preparation.
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| uploadToken | string | ✓ | ~ 1024 chars | Token received in preparation for upload | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description |
|---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.ImportUserDataByUserId(
&money.ImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}checkImportUserDataByUserId
Check if the import of the data associated with the specified user ID is complete
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128 chars | User ID | ||
| uploadToken | string | ✓ | ~ 1024 chars | Token received in preparation for upload | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| url | string | URL of log data |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
&money.CheckImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.UrldescribeWallets
Get a list of wallets
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve |
Result
| Type | Description | |
|---|---|---|
| items | List<Wallet> | List of Wallets |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.DescribeWallets(
&money.DescribeWalletsRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokendescribeWalletsByUserId
Get a list of Wallets by specifying a user ID
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| items | List<Wallet> | List of Wallets |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.DescribeWalletsByUserId(
&money.DescribeWalletsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokengetWallet
Get Wallet
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| slot | int | ✓ | 0 ~ 100000000 | Slot Number |
Result
| Type | Description | |
|---|---|---|
| item | Wallet | Wallet |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.GetWallet(
&money.GetWalletRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
Slot: pointy.Int32(0),
}
)
if err != nil {
panic("error occurred")
}
item := result.ItemgetWalletByUserId
Retrieve wallet by specifying a user ID
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| slot | int | ✓ | 0 ~ 100000000 | Slot Number | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | Wallet | Wallet |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.GetWalletByUserId(
&money.GetWalletByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Slot: pointy.Int32(0),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.ItemdepositByUserId
Deposit balance to wallet by specifying a user ID
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| slot | int | ✓ | 0 ~ 100000000 | Slot Number | ||
| 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 |
Result
| Type | Description | |
|---|---|---|
| item | Wallet | Wallet after deposit |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.DepositByUserId(
&money.DepositByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Slot: pointy.Int32(0),
Price: pointy.Float32(120),
Count: pointy.Int32(50),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemwithdraw
Consume balance from wallet
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| accessToken | string | ✓ | ~ 128 chars | Access token | ||
| slot | int | ✓ | 0 ~ 100000000 | Slot Number | ||
| count | int | ✓ | 1 ~ 2147483646 | Quantity of premium currency to be consumed | ||
| paidOnly | bool | false | Only for paid currency |
Result
| Type | Description | |
|---|---|---|
| item | Wallet | Post-withdraw Wallet |
| price | float | Price of currency consumed |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.Withdraw(
&money.WithdrawRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
Slot: pointy.Int32(0),
Count: pointy.Int32(50),
PaidOnly: pointy.Bool(false),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
price := result.PricewithdrawByUserId
Consume balance from wallet by specifying a user ID
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| slot | int | ✓ | 0 ~ 100000000 | Slot Number | ||
| count | int | ✓ | 1 ~ 2147483646 | Quantity of premium currency to be consumed | ||
| paidOnly | bool | false | Only for paid currency | |||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | Wallet | Post-withdraw Wallet |
| price | float | Price of currency consumed |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.WithdrawByUserId(
&money.WithdrawByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Slot: pointy.Int32(0),
Count: pointy.Int32(50),
PaidOnly: pointy.Bool(false),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
price := result.PricedescribeReceipts
Get a list of receipts
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| slot | int | 0 ~ 100000000 | Slot | |||
| begin | long | The absolute time 30 days prior to the current time | Search start date and time | |||
| end | long | Now | Search end date and time | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| items | List<Receipt> | List of Receipts |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.DescribeReceipts(
&money.DescribeReceiptsRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Slot: pointy.Int32(0),
Begin: nil,
End: nil,
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokengetByUserIdAndTransactionId
Get receipt by specifying user ID and transaction ID
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| transactionId | string | ✓ | ~ 1024 chars | Transaction ID | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | Receipt | Receipt |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.GetByUserIdAndTransactionId(
&money.GetByUserIdAndTransactionIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
TransactionId: pointy.String("transaction-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.ItemrecordReceipt
Record receipt
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| contentsId | string | ✓ | ~ 1024 chars | Content IDs sold on the store platform | ||
| receipt | string | ✓ | ~ 524288 chars | Receipt | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | Receipt | Recorded Receipt |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.RecordReceipt(
&money.RecordReceiptRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
ContentsId: pointy.String("contents-0001"),
Receipt: pointy.String("receipt..."),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.ItemrevertRecordReceipt
Delete receipt record by specifying a user ID
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID | ||
| receipt | string | ✓ | ~ 524288 chars | Receipt | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
Result
| Type | Description | |
|---|---|---|
| item | Receipt | Recorded Receipt |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/money"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := money.Gs2MoneyRestClient{
Session: &session,
}
result, err := client.RevertRecordReceipt(
&money.RevertRecordReceiptRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Receipt: pointy.String("receipt..."),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item