NAV
go python java php typescript csharp GS2-Script

GS2-Money

GS2-SDK のリファレンス

モデル

Namespace

ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。 GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。

そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。

説明
namespaceId string ネームスペースGRN
name string ネームスペースの名前
description string 説明文
priority string 消費優先度
shareFree bool 無償課金通貨を異なるスロットで共有するか
currency string 通貨の種類
appleKey string Apple AppStore のバンドルID
googleKey string Google PlayStore の秘密鍵
enableFakeReceipt bool UnityEditorが出力する偽のレシートで決済できるようにするか
createWalletScript ScriptSetting ウォレット新規作成したときに実行するスクリプト
depositScript ScriptSetting ウォレット残高加算したときに実行するスクリプト
withdrawScript ScriptSetting ウォレット残高消費したときに実行するスクリプト
balance double 未使用残高
logSetting LogSetting ログの出力設定
createdAt long 作成日時
updatedAt long 最終更新日時

Wallet

ウォレットはゲームプレイヤー毎に課金通貨の所持数量を保持するエンティティです。

ウォレット内の通貨は大きく有償で購入した通貨と、無償で入手した通貨が分けて管理されます。 有償で購入した通貨は更に購入時の単価毎に管理され、サービス終了になってしまった際の返金や資金決済法に該当するだけの残高が存在するかが集計できます。

ウォレットにはスロットがあり、スロットごとに異なる残高を管理できます。 プラットフォームをまたいで残高を共有できない場合にはプラットフォーム毎に異なるスロットを利用することで分けて管理することができます。 その際に無償で入手した通貨は全てのプラットフォームで共通した値を利用することもできます。

説明
walletId string ウォレットGRN
userId string ユーザーID
slot int スロット番号
paid int 有償課金通貨所持量
free int 無償課金通貨所持量
detail WalletDetail[] 詳細
createdAt long 作成日時
updatedAt long 最終更新日時

Receipt

説明
receiptId string レシートGRN
transactionId string トランザクションID
userId string ユーザーID
type string 種類
slot int スロット番号
price float 単価
paid int 有償課金通貨
free int 無償課金通貨
total int 総数
contentsId string ストアプラットフォームで販売されているコンテンツID
createdAt long 作成日時

WalletDetail

説明
price float 単価
count int 所持量

ScriptSetting

説明
triggerScriptId string スクリプトGRN
doneTriggerTargetType string 完了通知の通知先
doneTriggerScriptId string スクリプトGRN
doneTriggerQueueNamespaceId string ネームスペースGRN

LogSetting

説明
loggingNamespaceId string ネームスペースGRN

メソッド

describeNamespaces

describeNamespaces

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 {
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\DescribeNamespacesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeNamespaces(
        (new DescribeNamespacesRequest())
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.DescribeNamespacesRequest;
import io.gs2.money.result.DescribeNamespacesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    DescribeNamespacesResult result = client.describeNamespaces(
        new DescribeNamespacesRequest()
            .withPageToken(null)
            .withLimit(null)
    );
    List<Namespace> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.DescribeNamespacesRequest;
using Gs2.Gs2Money.Result.DescribeNamespacesResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeNamespaces(
    new DescribeNamespacesRequest()
        .withPageToken(null)
        .withLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.describeNamespaces(
        new Gs2Money.DescribeNamespacesRequest()
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.describe_namespaces(
        new money.DescribeNamespacesRequest()
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.describe_namespaces({
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

ネームスペースの一覧を取得します

Request

必須 デフォルト 値の制限 説明
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Namespace[] ネームスペースのリスト
nextPageToken string リストの続きを取得するためのページトークン

createNamespace

createNamespace

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("namespace1"),
        Description: 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:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\CreateNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName(self::namespace1)
            ->withDescription(null)
            ->withPriority('paid')
            ->withShareFree(False)
            ->withCurrency('USD')
            ->withAppleKey(null)
            ->withGoogleKey(null)
            ->withEnableFakeReceipt(null)
            ->withCreateWalletScript(null)
            ->withDepositScript(null)
            ->withWithdrawScript(null)
            ->withLogSetting((new \Gs2\Money\Model\LogSetting())
                ->withLoggingNamespaceId('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.CreateNamespaceRequest;
import io.gs2.money.result.CreateNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace1")
            .withDescription(null)
            .withPriority("paid")
            .withShareFree(false)
            .withCurrency("USD")
            .withAppleKey(null)
            .withGoogleKey(null)
            .withEnableFakeReceipt(null)
            .withCreateWalletScript(null)
            .withDepositScript(null)
            .withWithdrawScript(null)
            .withLogSetting(new io.gs2.money.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.CreateNamespaceRequest;
using Gs2.Gs2Money.Result.CreateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createNamespace(
    new CreateNamespaceRequest()
        .withName("namespace1")
        .withDescription(null)
        .withPriority("paid")
        .withShareFree(false)
        .withCurrency("USD")
        .withAppleKey(null)
        .withGoogleKey(null)
        .withEnableFakeReceipt(null)
        .withCreateWalletScript(null)
        .withDepositScript(null)
        .withWithdrawScript(null)
        .withLogSetting(new Gs2.Gs2Money.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.createNamespace(
        new Gs2Money.CreateNamespaceRequest()
            .withName('namespace1')
            .withDescription(undefined)
            .withPriority('paid')
            .withShareFree(false)
            .withCurrency('USD')
            .withAppleKey(undefined)
            .withGoogleKey(undefined)
            .withEnableFakeReceipt(undefined)
            .withCreateWalletScript(undefined)
            .withDepositScript(undefined)
            .withWithdrawScript(undefined)
            .withLogSetting(new Gs2Money.Model.LogSetting()
                .withLoggingNamespaceId('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.create_namespace(
        new money.CreateNamespaceRequest()
            .with_name(self.hash1)
            .with_description(None)
            .with_priority('paid')
            .with_share_free(False)
            .with_currency('USD')
            .with_apple_key(None)
            .with_google_key(None)
            .with_enable_fake_receipt(None)
            .with_create_wallet_script(None)
            .with_deposit_script(None)
            .with_withdraw_script(None)
            .with_log_setting(
                money.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.create_namespace({
    name='namespace1',
    description=nil,
    priority='paid',
    shareFree=false,
    currency='USD',
    appleKey=nil,
    googleKey=nil,
    enableFakeReceipt=nil,
    createWalletScript=nil,
    depositScript=nil,
    withdrawScript=nil,
    logSetting={
        loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
    },
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ネームスペースを新規作成します

Request

必須 デフォルト 値の制限 説明
name string ~ 32文字 ネームスペースの名前
description string ~ 1024文字 説明文
priority string ~ 128文字 消費優先度
shareFree bool 無償課金通貨を異なるスロットで共有するか
currency string ~ 128文字 通貨の種類
appleKey string ~ 1024文字 Apple AppStore のバンドルID
googleKey string ~ 5120文字 Google PlayStore の秘密鍵
enableFakeReceipt bool false UnityEditorが出力する偽のレシートで決済できるようにするか
createWalletScript ScriptSetting ウォレット新規作成したときに実行するスクリプト
depositScript ScriptSetting ウォレット残高加算したときに実行するスクリプト
withdrawScript ScriptSetting ウォレット残高消費したときに実行するスクリプト
logSetting LogSetting ログの出力設定

Result

説明
item Namespace 作成したネームスペース

getNamespaceStatus

getNamespaceStatus

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
status := result.Status
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\GetNamespaceStatusRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getNamespaceStatus(
        (new GetNamespaceStatusRequest())
            ->withNamespaceName(self::namespace1)
    );
    $status = $result->getStatus();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.GetNamespaceStatusRequest;
import io.gs2.money.result.GetNamespaceStatusResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    GetNamespaceStatusResult result = client.getNamespaceStatus(
        new GetNamespaceStatusRequest()
            .withNamespaceName("namespace1")
    );
    String status = result.getStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Money.Result.GetNamespaceStatusResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getNamespaceStatus(
    new GetNamespaceStatusRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.getNamespaceStatus(
        new Gs2Money.GetNamespaceStatusRequest()
            .withNamespaceName('namespace1')
    );
    const status = result.getStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.get_namespace_status(
        new money.GetNamespaceStatusRequest()
            .with_namespace_name(self.hash1)
    )
    status = result.status
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.get_namespace_status({
    namespaceName='namespace1',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
status = result.status;

ネームスペースの状態を取得します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前

Result

説明
status string

getNamespace

getNamespace

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\GetNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getNamespace(
        (new GetNamespaceRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.GetNamespaceRequest;
import io.gs2.money.result.GetNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    GetNamespaceResult result = client.getNamespace(
        new GetNamespaceRequest()
            .withNamespaceName("namespace1")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.GetNamespaceRequest;
using Gs2.Gs2Money.Result.GetNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getNamespace(
    new GetNamespaceRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.getNamespace(
        new Gs2Money.GetNamespaceRequest()
            .withNamespaceName('namespace1')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.get_namespace(
        new money.GetNamespaceRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.get_namespace({
    namespaceName='namespace1',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ネームスペースを取得します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前

Result

説明
item Namespace ネームスペース

updateNamespace

updateNamespace

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("namespace1"),
        Description: pointy.String("description1"),
        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:namespace1:script:script-1001"),
            DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002"),
        },
        DepositScript: &money.ScriptSetting{
            TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003"),
            DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004"),
        },
        WithdrawScript: &money.ScriptSetting{
            TriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005"),
            DoneTriggerScriptId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006"),
        },
        LogSetting: &money.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\UpdateNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName(self::namespace1)
            ->withDescription('description1')
            ->withPriority('paid')
            ->withAppleKey('io.gs2.sample')
            ->withGoogleKey('MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB')
            ->withEnableFakeReceipt(null)
            ->withCreateWalletScript((new \Gs2\Money\Model\ScriptSetting())
                ->withTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001')
                ->withDoneTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002'))
            ->withDepositScript((new \Gs2\Money\Model\ScriptSetting())
                ->withTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003')
                ->withDoneTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004'))
            ->withWithdrawScript((new \Gs2\Money\Model\ScriptSetting())
                ->withTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005')
                ->withDoneTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006'))
            ->withLogSetting((new \Gs2\Money\Model\LogSetting())
                ->withLoggingNamespaceId('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.UpdateNamespaceRequest;
import io.gs2.money.result.UpdateNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withPriority("paid")
            .withAppleKey("io.gs2.sample")
            .withGoogleKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB")
            .withEnableFakeReceipt(null)
            .withCreateWalletScript(new io.gs2.money.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002"))
            .withDepositScript(new io.gs2.money.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004"))
            .withWithdrawScript(new io.gs2.money.model.ScriptSetting()
                .withTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005")
                .withDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006"))
            .withLogSetting(new io.gs2.money.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.UpdateNamespaceRequest;
using Gs2.Gs2Money.Result.UpdateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateNamespace(
    new UpdateNamespaceRequest()
        .withNamespaceName("namespace1")
        .withDescription("description1")
        .withPriority("paid")
        .withAppleKey("io.gs2.sample")
        .withGoogleKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB")
        .withEnableFakeReceipt(null)
        .withCreateWalletScript(new Gs2.Gs2Money.Model.ScriptSetting()
            .WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001")
            .WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002"))
        .withDepositScript(new Gs2.Gs2Money.Model.ScriptSetting()
            .WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003")
            .WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004"))
        .withWithdrawScript(new Gs2.Gs2Money.Model.ScriptSetting()
            .WithTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005")
            .WithDoneTriggerScriptId("grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006"))
        .withLogSetting(new Gs2.Gs2Money.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.updateNamespace(
        new Gs2Money.UpdateNamespaceRequest()
            .withNamespaceName('namespace1')
            .withDescription('description1')
            .withPriority('paid')
            .withAppleKey('io.gs2.sample')
            .withGoogleKey('MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB')
            .withEnableFakeReceipt(undefined)
            .withCreateWalletScript(new Gs2Money.Model.ScriptSetting()
                .withTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001')
                .withDoneTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002'))
            .withDepositScript(new Gs2Money.Model.ScriptSetting()
                .withTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003')
                .withDoneTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004'))
            .withWithdrawScript(new Gs2Money.Model.ScriptSetting()
                .withTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005')
                .withDoneTriggerScriptId('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006'))
            .withLogSetting(new Gs2Money.Model.LogSetting()
                .withLoggingNamespaceId('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.update_namespace(
        new money.UpdateNamespaceRequest()
            .with_namespace_name(self.hash1)
            .with_description('description1')
            .with_priority('paid')
            .with_apple_key('io.gs2.sample')
            .with_google_key('MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB')
            .with_enable_fake_receipt(None)
            .with_create_wallet_script(
                money.ScriptSetting()
                    .with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001')
                    .with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002'))
            .with_deposit_script(
                money.ScriptSetting()
                    .with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003')
                    .with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004'))
            .with_withdraw_script(
                money.ScriptSetting()
                    .with_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005')
                    .with_done_trigger_script_id('grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006'))
            .with_log_setting(
                money.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.update_namespace({
    namespaceName='namespace1',
    description='description1',
    priority='paid',
    appleKey='io.gs2.sample',
    googleKey='MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAicE6mZuA6w39F+xhKQfn+KJw9AVxLuwsJGS8oTRj8K9IPTfs4BVuVLYkgxz7qA0ltO20X2Xvkf/lRfZJBLlwMa1PihXv96/sipj6FPu7xsqlvvaPmDi5JT5+8XirE33M8ezR5M7QlUoNHOuELT+DGxbnFn1s/A3bGI58SYqLzQvoqrEDGHKfKsCtP5ncX1ZwF8AFvk5WQlK5W3wkkrZXrbJbBsfur+5hWpVg5qS+dXAKSrKPfPmq9Fn11rhMDutGmm8BQ+/fDMz5jiuAVWcSjhEn7HI473es7dquQ7OO4NZJ0R9vkpTiQUzrEdnforr51du0riegjJOLTQtXAKLOIQIDAQAB',
    enableFakeReceipt=nil,
    createWalletScript={
        triggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1001',
        doneTriggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1002',
    },
    depositScript={
        triggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1003',
        doneTriggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1004',
    },
    withdrawScript={
        triggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1005',
        doneTriggerScriptId='grn:gs2:ap-northeast-1:YourOwnerId:script:namespace1:script:script-1006',
    },
    logSetting={
        loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
    },
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ネームスペースを更新します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
description string ~ 1024文字 説明文
priority string ~ 128文字 消費優先度
appleKey string ~ 1024文字 Apple AppStore のバンドルID
googleKey string ~ 5120文字 Google PlayStore の秘密鍵
enableFakeReceipt bool false UnityEditorが出力する偽のレシートで決済できるようにするか
createWalletScript ScriptSetting ウォレット新規作成したときに実行するスクリプト
depositScript ScriptSetting ウォレット残高加算したときに実行するスクリプト
withdrawScript ScriptSetting ウォレット残高消費したときに実行するスクリプト
logSetting LogSetting ログの出力設定

Result

説明
item Namespace 更新したネームスペース

deleteNamespace

deleteNamespace

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("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\DeleteNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteNamespace(
        (new DeleteNamespaceRequest())
            ->withNamespaceName(self::namespace1)
    );
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.DeleteNamespaceRequest;
import io.gs2.money.result.DeleteNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    DeleteNamespaceResult result = client.deleteNamespace(
        new DeleteNamespaceRequest()
            .withNamespaceName("namespace1")
    );
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.DeleteNamespaceRequest;
using Gs2.Gs2Money.Result.DeleteNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteNamespace(
    new DeleteNamespaceRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.deleteNamespace(
        new Gs2Money.DeleteNamespaceRequest()
            .withNamespaceName('namespace1')
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.delete_namespace(
        new money.DeleteNamespaceRequest()
            .with_namespace_name(self.hash1)
    )
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.delete_namespace({
    namespaceName='namespace1',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result

ネームスペースを削除します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前

Result

説明

describeWallets

describeWallets

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("namespace1"),
        AccessToken: pointy.String("$access_token_0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\DescribeWalletsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeWallets(
        (new DescribeWalletsRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.DescribeWalletsRequest;
import io.gs2.money.result.DescribeWalletsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    DescribeWalletsResult result = client.describeWallets(
        new DescribeWalletsRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Wallet> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.DescribeWalletsRequest;
using Gs2.Gs2Money.Result.DescribeWalletsResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeWallets(
    new DescribeWalletsRequest()
        .withNamespaceName("namespace1")
        .withAccessToken("$access_token_0001")
        .withPageToken(null)
        .withLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.describeWallets(
        new Gs2Money.DescribeWalletsRequest()
            .withNamespaceName('namespace1')
            .withAccessToken('$access_token_0001')
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.describe_wallets(
        new money.DescribeWalletsRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.describe_wallets({
    namespaceName='namespace1',
    accessToken='$access_token_0001',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

ウォレット一覧を取得します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
accessToken string ~ 128文字 ユーザーID
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Wallet[] ウォレットのリスト
nextPageToken string リストの続きを取得するためのページトークン

describeWalletsByUserId

describeWalletsByUserId

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("namespace1"),
        UserId: pointy.String("user-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\DescribeWalletsByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeWalletsByUserId(
        (new DescribeWalletsByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId('user-0001')
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.DescribeWalletsByUserIdRequest;
import io.gs2.money.result.DescribeWalletsByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    DescribeWalletsByUserIdResult result = client.describeWalletsByUserId(
        new DescribeWalletsByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Wallet> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.DescribeWalletsByUserIdRequest;
using Gs2.Gs2Money.Result.DescribeWalletsByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeWalletsByUserId(
    new DescribeWalletsByUserIdRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-0001")
        .withPageToken(null)
        .withLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.describeWalletsByUserId(
        new Gs2Money.DescribeWalletsByUserIdRequest()
            .withNamespaceName('namespace1')
            .withUserId('user-0001')
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.describe_wallets_by_user_id(
        new money.DescribeWalletsByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.describe_wallets_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

ウォレット一覧を取得します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
userId string ~ 128文字 ユーザーID
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Wallet[] ウォレットのリスト
nextPageToken string リストの続きを取得するためのページトークン

getWallet

getWallet

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("namespace1"),
        AccessToken: pointy.String("$access_token_0001"),
        Slot: pointy.Int32(0),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\GetWalletRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getWallet(
        (new GetWalletRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->withSlot(0)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.GetWalletRequest;
import io.gs2.money.result.GetWalletResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    GetWalletResult result = client.getWallet(
        new GetWalletRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withSlot(0)
    );
    Wallet item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.GetWalletRequest;
using Gs2.Gs2Money.Result.GetWalletResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getWallet(
    new GetWalletRequest()
        .withNamespaceName("namespace1")
        .withAccessToken("$access_token_0001")
        .withSlot(0),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.getWallet(
        new Gs2Money.GetWalletRequest()
            .withNamespaceName('namespace1')
            .withAccessToken('$access_token_0001')
            .withSlot(0)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.get_wallet(
        new money.GetWalletRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
            .with_slot(0)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.get_wallet({
    namespaceName='namespace1',
    accessToken='$access_token_0001',
    slot=0,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ウォレットを取得します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
accessToken string ~ 128文字 ユーザーID
slot int ~ 100000000 スロット番号

Result

説明
item Wallet ウォレット

getWalletByUserId

getWalletByUserId

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("namespace1"),
        UserId: pointy.String("user-0001"),
        Slot: pointy.Int32(0),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\GetWalletByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getWalletByUserId(
        (new GetWalletByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId('user-0001')
            ->withSlot(0)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.GetWalletByUserIdRequest;
import io.gs2.money.result.GetWalletByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    GetWalletByUserIdResult result = client.getWalletByUserId(
        new GetWalletByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withSlot(0)
    );
    Wallet item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.GetWalletByUserIdRequest;
using Gs2.Gs2Money.Result.GetWalletByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getWalletByUserId(
    new GetWalletByUserIdRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-0001")
        .withSlot(0),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.getWalletByUserId(
        new Gs2Money.GetWalletByUserIdRequest()
            .withNamespaceName('namespace1')
            .withUserId('user-0001')
            .withSlot(0)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.get_wallet_by_user_id(
        new money.GetWalletByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_slot(0)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.get_wallet_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    slot=0,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ユーザーIDを指定してウォレットを取得します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
userId string ~ 128文字 ユーザーID
slot int ~ 100000000 スロット番号

Result

説明
item Wallet ウォレット

depositByUserId

depositByUserId

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("namespace1"),
        UserId: pointy.String("user-0001"),
        Slot: pointy.Int32(0),
        Price: pointy.Float32(120),
        Count: pointy.Int32(50),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\DepositByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->depositByUserId(
        (new DepositByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId('user-0001')
            ->withSlot(0)
            ->withPrice(120)
            ->withCount(50)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.DepositByUserIdRequest;
import io.gs2.money.result.DepositByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    DepositByUserIdResult result = client.depositByUserId(
        new DepositByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withSlot(0)
            .withPrice(120f)
            .withCount(50)
    );
    Wallet item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.DepositByUserIdRequest;
using Gs2.Gs2Money.Result.DepositByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.depositByUserId(
    new DepositByUserIdRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-0001")
        .withSlot(0)
        .withPrice(120f)
        .withCount(50),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.depositByUserId(
        new Gs2Money.DepositByUserIdRequest()
            .withNamespaceName('namespace1')
            .withUserId('user-0001')
            .withSlot(0)
            .withPrice(120)
            .withCount(50)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.deposit_by_user_id(
        new money.DepositByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_slot(0)
            .with_price(120)
            .with_count(50)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.deposit_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    slot=0,
    price=120,
    count=50,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ユーザーIDを指定してウォレットに残高を加算します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
userId string ~ 128文字 ユーザーID
slot int ~ 100000000 スロット番号
price float ~ 100000.0 購入価格
count int 1 ~ 9223372036854775807 付与する課金通貨の数量

Result

説明
item Wallet 加算後のウォレット

withdraw

withdraw

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("namespace1"),
        AccessToken: pointy.String("$access_token_0001"),
        Slot: pointy.Int32(0),
        Count: pointy.Int32(50),
        PaidOnly: pointy.Bool(false),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
price := result.Price
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\WithdrawRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->withdraw(
        (new WithdrawRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->withSlot(0)
            ->withCount(50)
            ->withPaidOnly(False)
    );
    $item = $result->getItem();
    $price = $result->getPrice();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.WithdrawRequest;
import io.gs2.money.result.WithdrawResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    WithdrawResult result = client.withdraw(
        new WithdrawRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withSlot(0)
            .withCount(50)
            .withPaidOnly(false)
    );
    Wallet item = result.getItem();
    float price = result.getPrice();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.WithdrawRequest;
using Gs2.Gs2Money.Result.WithdrawResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.withdraw(
    new WithdrawRequest()
        .withNamespaceName("namespace1")
        .withAccessToken("$access_token_0001")
        .withSlot(0)
        .withCount(50)
        .withPaidOnly(false),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var price = result.Price;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.withdraw(
        new Gs2Money.WithdrawRequest()
            .withNamespaceName('namespace1')
            .withAccessToken('$access_token_0001')
            .withSlot(0)
            .withCount(50)
            .withPaidOnly(false)
    );
    const item = result.getItem();
    const price = result.getPrice();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.withdraw(
        new money.WithdrawRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
            .with_slot(0)
            .with_count(50)
            .with_paid_only(False)
    )
    item = result.item
    price = result.price
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.withdraw({
    namespaceName='namespace1',
    accessToken='$access_token_0001',
    slot=0,
    count=50,
    paidOnly=false,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;
price = result.price;

ウォレットから残高を消費します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
accessToken string ~ 128文字 ユーザーID
slot int ~ 100000000 スロット番号
count int 1 ~ 9223372036854775807 消費する課金通貨の数量
paidOnly bool false 有償課金通貨のみを対象とするか

Result

説明
item Wallet 消費後のウォレット
price float 消費した通貨の価格

withdrawByUserId

withdrawByUserId

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("namespace1"),
        UserId: pointy.String("user-0001"),
        Slot: pointy.Int32(0),
        Count: pointy.Int32(50),
        PaidOnly: pointy.Bool(false),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
price := result.Price
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\WithdrawByUserIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->withdrawByUserId(
        (new WithdrawByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId('user-0001')
            ->withSlot(0)
            ->withCount(50)
            ->withPaidOnly(False)
    );
    $item = $result->getItem();
    $price = $result->getPrice();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.WithdrawByUserIdRequest;
import io.gs2.money.result.WithdrawByUserIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    WithdrawByUserIdResult result = client.withdrawByUserId(
        new WithdrawByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withSlot(0)
            .withCount(50)
            .withPaidOnly(false)
    );
    Wallet item = result.getItem();
    float price = result.getPrice();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.WithdrawByUserIdRequest;
using Gs2.Gs2Money.Result.WithdrawByUserIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.withdrawByUserId(
    new WithdrawByUserIdRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-0001")
        .withSlot(0)
        .withCount(50)
        .withPaidOnly(false),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var price = result.Price;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.withdrawByUserId(
        new Gs2Money.WithdrawByUserIdRequest()
            .withNamespaceName('namespace1')
            .withUserId('user-0001')
            .withSlot(0)
            .withCount(50)
            .withPaidOnly(false)
    );
    const item = result.getItem();
    const price = result.getPrice();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.withdraw_by_user_id(
        new money.WithdrawByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_slot(0)
            .with_count(50)
            .with_paid_only(False)
    )
    item = result.item
    price = result.price
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.withdraw_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    slot=0,
    count=50,
    paidOnly=false,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;
price = result.price;

ユーザーIDを指定してウォレットから残高を消費します

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
userId string ~ 128文字 ユーザーID
slot int ~ 100000000 スロット番号
count int 1 ~ 9223372036854775807 消費する課金通貨の数量
paidOnly bool false 有償課金通貨のみを対象とするか

Result

説明
item Wallet 消費後のウォレット
price float 消費した通貨の価格

depositByStampSheet

depositByStampSheet

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.DepositByStampSheet(
    &money.DepositByStampSheetRequest {
        StampSheet: pointy.String("$stampSheet"),
        KeyId: pointy.String("$key1.keyId"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\DepositByStampSheetRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->depositByStampSheet(
        (new DepositByStampSheetRequest())
            ->withStampSheet(self::$stampSheet)
            ->withKeyId(self::$key1.keyId)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.DepositByStampSheetRequest;
import io.gs2.money.result.DepositByStampSheetResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    DepositByStampSheetResult result = client.depositByStampSheet(
        new DepositByStampSheetRequest()
            .withStampSheet("$stampSheet")
            .withKeyId("$key1.keyId")
    );
    Wallet item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.DepositByStampSheetRequest;
using Gs2.Gs2Money.Result.DepositByStampSheetResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.depositByStampSheet(
    new DepositByStampSheetRequest()
        .withStampSheet("$stampSheet")
        .withKeyId("$key1.keyId"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.depositByStampSheet(
        new Gs2Money.DepositByStampSheetRequest()
            .withStampSheet('$stampSheet')
            .withKeyId('$key1.keyId')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.deposit_by_stamp_sheet(
        new money.DepositByStampSheetRequest()
            .with_stamp_sheet(self.stamp_sheet)
            .with_key_id(self.key1.key_id)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.deposit_by_stamp_sheet({
    stampSheet='$stampSheet',
    keyId='$key1.keyId',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタンプシートを使用してウォレットに残高を加算します

Request

必須 デフォルト 値の制限 説明
stampSheet string ~ 5242880文字 スタンプシート
keyId string ~ 1024文字 暗号鍵GRN

Result

説明
item Wallet 加算後のウォレット

withdrawByStampTask

withdrawByStampTask

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.WithdrawByStampTask(
    &money.WithdrawByStampTaskRequest {
        StampTask: pointy.String("$stampTask"),
        KeyId: pointy.String("$key1.keyId"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
price := result.Price
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\WithdrawByStampTaskRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->withdrawByStampTask(
        (new WithdrawByStampTaskRequest())
            ->withStampTask(self::$stampTask)
            ->withKeyId(self::$key1.keyId)
    );
    $item = $result->getItem();
    $price = $result->getPrice();
    $newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.WithdrawByStampTaskRequest;
import io.gs2.money.result.WithdrawByStampTaskResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    WithdrawByStampTaskResult result = client.withdrawByStampTask(
        new WithdrawByStampTaskRequest()
            .withStampTask("$stampTask")
            .withKeyId("$key1.keyId")
    );
    Wallet item = result.getItem();
    float price = result.getPrice();
    String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.WithdrawByStampTaskRequest;
using Gs2.Gs2Money.Result.WithdrawByStampTaskResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.withdrawByStampTask(
    new WithdrawByStampTaskRequest()
        .withStampTask("$stampTask")
        .withKeyId("$key1.keyId"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var price = result.Price;
var newContextStack = result.NewContextStack;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.withdrawByStampTask(
        new Gs2Money.WithdrawByStampTaskRequest()
            .withStampTask('$stampTask')
            .withKeyId('$key1.keyId')
    );
    const item = result.getItem();
    const price = result.getPrice();
    const newContextStack = result.getNewContextStack();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.withdraw_by_stamp_task(
        new money.WithdrawByStampTaskRequest()
            .with_stamp_task(self.stamp_task)
            .with_key_id(self.key1.key_id)
    )
    item = result.item
    price = result.price
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.withdraw_by_stamp_task({
    stampTask='$stampTask',
    keyId='$key1.keyId',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;
price = result.price;
newContextStack = result.newContextStack;

ウォレットから残高を消費します

Request

必須 デフォルト 値の制限 説明
stampTask string ~ 5242880文字 スタンプタスク
keyId string ~ 1024文字 暗号鍵GRN

Result

説明
item Wallet 消費後のウォレット
price float 消費した通貨の価格
newContextStack string スタンプタスクの実行結果を記録したコンテキスト

describeReceipts

describeReceipts

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("namespace1"),
        UserId: pointy.String("user-0001"),
        Slot: pointy.Int32(0),
        Begin: nil,
        End: nil,
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\DescribeReceiptsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeReceipts(
        (new DescribeReceiptsRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId('user-0001')
            ->withSlot(0)
            ->withBegin(null)
            ->withEnd(null)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.DescribeReceiptsRequest;
import io.gs2.money.result.DescribeReceiptsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    DescribeReceiptsResult result = client.describeReceipts(
        new DescribeReceiptsRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withSlot(0)
            .withBegin(null)
            .withEnd(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<Receipt> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.DescribeReceiptsRequest;
using Gs2.Gs2Money.Result.DescribeReceiptsResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeReceipts(
    new DescribeReceiptsRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-0001")
        .withSlot(0)
        .withBegin(null)
        .withEnd(null)
        .withPageToken(null)
        .withLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.describeReceipts(
        new Gs2Money.DescribeReceiptsRequest()
            .withNamespaceName('namespace1')
            .withUserId('user-0001')
            .withSlot(0)
            .withBegin(undefined)
            .withEnd(undefined)
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.describe_receipts(
        new money.DescribeReceiptsRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_slot(0)
            .with_begin(None)
            .with_end(None)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.describe_receipts({
    namespaceName='namespace1',
    userId='user-0001',
    slot=0,
    begin=nil,
    end=nil,
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

レシートの一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
userId string ~ 128文字 ユーザーID
slot int ~ 100000000 スロット
begin long 現在時刻からのオフセット(-720時間) 検索開始日時
end long 現在時刻 検索終了日時
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Receipt[] レシートのリスト
nextPageToken string リストの続きを取得するためのページトークン

getByUserIdAndTransactionId

getByUserIdAndTransactionId

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("namespace1"),
        UserId: pointy.String("user-0001"),
        TransactionId: pointy.String("transaction-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\GetByUserIdAndTransactionIdRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getByUserIdAndTransactionId(
        (new GetByUserIdAndTransactionIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId('user-0001')
            ->withTransactionId('transaction-0001')
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.GetByUserIdAndTransactionIdRequest;
import io.gs2.money.result.GetByUserIdAndTransactionIdResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    GetByUserIdAndTransactionIdResult result = client.getByUserIdAndTransactionId(
        new GetByUserIdAndTransactionIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withTransactionId("transaction-0001")
    );
    Receipt item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.GetByUserIdAndTransactionIdRequest;
using Gs2.Gs2Money.Result.GetByUserIdAndTransactionIdResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getByUserIdAndTransactionId(
    new GetByUserIdAndTransactionIdRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-0001")
        .withTransactionId("transaction-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.getByUserIdAndTransactionId(
        new Gs2Money.GetByUserIdAndTransactionIdRequest()
            .withNamespaceName('namespace1')
            .withUserId('user-0001')
            .withTransactionId('transaction-0001')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.get_by_user_id_and_transaction_id(
        new money.GetByUserIdAndTransactionIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_transaction_id('transaction-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.get_by_user_id_and_transaction_id({
    namespaceName='namespace1',
    userId='user-0001',
    transactionId='transaction-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

レシートの一覧を取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
userId string ~ 128文字 ユーザーID
transactionId string ~ 1024文字 トランザクションID

Result

説明
item Receipt レシート

recordReceipt

recordReceipt

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("namespace1"),
        UserId: pointy.String("user-0001"),
        ContentsId: pointy.String("contents-0001"),
        Receipt: pointy.String("$receipt"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\RecordReceiptRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->recordReceipt(
        (new RecordReceiptRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId('user-0001')
            ->withContentsId('contents-0001')
            ->withReceipt(self::$receipt)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.RecordReceiptRequest;
import io.gs2.money.result.RecordReceiptResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    RecordReceiptResult result = client.recordReceipt(
        new RecordReceiptRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withContentsId("contents-0001")
            .withReceipt("$receipt")
    );
    Receipt item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.RecordReceiptRequest;
using Gs2.Gs2Money.Result.RecordReceiptResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.recordReceipt(
    new RecordReceiptRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-0001")
        .withContentsId("contents-0001")
        .withReceipt("$receipt"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.recordReceipt(
        new Gs2Money.RecordReceiptRequest()
            .withNamespaceName('namespace1')
            .withUserId('user-0001')
            .withContentsId('contents-0001')
            .withReceipt('$receipt')
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.record_receipt(
        new money.RecordReceiptRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_contents_id('contents-0001')
            .with_receipt(self.receipt)
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.record_receipt({
    namespaceName='namespace1',
    userId='user-0001',
    contentsId='contents-0001',
    receipt='$receipt',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

レシートを記録

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペースの名前
userId string ~ 128文字 ユーザーID
contentsId string ~ 1024文字 ストアプラットフォームで販売されているコンテンツID
receipt string ~ 1048576文字 レシート

Result

説明
item Receipt レシート

recordReceiptByStampTask

recordReceiptByStampTask

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.RecordReceiptByStampTask(
    &money.RecordReceiptByStampTaskRequest {
        StampTask: pointy.String("$stampTask"),
        KeyId: pointy.String("$key1.keyId"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
newContextStack := result.NewContextStack
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Money\Gs2MoneyRestClient;
use Gs2\Money\Request\RecordReceiptByStampTaskRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->recordReceiptByStampTask(
        (new RecordReceiptByStampTaskRequest())
            ->withStampTask(self::$stampTask)
            ->withKeyId(self::$key1.keyId)
    );
    $item = $result->getItem();
    $newContextStack = $result->getNewContextStack();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.money.rest.Gs2MoneyRestClient;
import io.gs2.money.request.RecordReceiptByStampTaskRequest;
import io.gs2.money.result.RecordReceiptByStampTaskResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2MoneyRestClient client = new Gs2MoneyRestClient(session);

try {
    RecordReceiptByStampTaskResult result = client.recordReceiptByStampTask(
        new RecordReceiptByStampTaskRequest()
            .withStampTask("$stampTask")
            .withKeyId("$key1.keyId")
    );
    Receipt item = result.getItem();
    String newContextStack = result.getNewContextStack();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Money.Gs2MoneyRestClient;
using Gs2.Gs2Money.Request.RecordReceiptByStampTaskRequest;
using Gs2.Gs2Money.Result.RecordReceiptByStampTaskResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2MoneyRestClient(session);

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.recordReceiptByStampTask(
    new RecordReceiptByStampTaskRequest()
        .withStampTask("$stampTask")
        .withKeyId("$key1.keyId"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var newContextStack = result.NewContextStack;
import Gs2Core from '@/gs2/core';
import * as Gs2Money from '@/gs2/money';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Money.Gs2MoneyRestClient(session);

try {
    const result = await client.recordReceiptByStampTask(
        new Gs2Money.RecordReceiptByStampTaskRequest()
            .withStampTask('$stampTask')
            .withKeyId('$key1.keyId')
    );
    const item = result.getItem();
    const newContextStack = result.getNewContextStack();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import money

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new money.Gs2MoneyRestClient(session)

try:
    result = client.record_receipt_by_stamp_task(
        new money.RecordReceiptByStampTaskRequest()
            .with_stamp_task(self.stamp_task)
            .with_key_id(self.key1.key_id)
    )
    item = result.item
    new_context_stack = result.new_context_stack
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('money')

api_result = client.record_receipt_by_stamp_task({
    stampTask='$stampTask',
    keyId='$key1.keyId',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;
newContextStack = result.newContextStack;

スタンプシートを使用してレシートを記録

Request

必須 デフォルト 値の制限 説明
stampTask string ~ 5242880文字 スタンプタスク
keyId string ~ 1024文字 暗号鍵GRN

Result

説明
item Receipt レシート
newContextStack string スタンプタスクの実行結果を記録したコンテキスト