Trigger Reference of GS2-Money2 Script

Reference of event triggers that call extended scripts

Trigger

deposit

Wallet balance addition

Synchronous Execution Script

Script and Wallet balance addition are executed synchronously in that order.

Request
TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before deposit
newWalletWalletWallet after deposit
transactionsDepositTransaction[]List of occurred transactions
countintAmount of balance to be added
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow wallet balance addition
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count

result = {
  permit=permit
}

Asynchronous Execution Script

The script executes asynchronously after the Wallet balance addition.

Request
TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before deposit
newWalletWalletWallet after deposit
transactionsDepositTransaction[]List of occurred transactions
countintAmount of balance to be added
Result
TypeRequiredDefaultValue LimitsDescription
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count

result = {
}

withdraw

Wallet balance consumption

Synchronous Execution Script

Script and Wallet balance consumption are executed synchronously in that order.

Request
TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before withdraw
newWalletWalletWallet after withdraw
transactionsDepositTransaction[]List of occurred transactions
countintAmount of balance to be consumed
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow wallet balance consumption
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count

result = {
  permit=permit
}

Asynchronous Execution Script

The script executes asynchronously after the Wallet balance consumption.

Request
TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before withdraw
newWalletWalletWallet after withdraw
transactionsDepositTransaction[]List of occurred transactions
countintAmount of balance to be consumed
Result
TypeRequiredDefaultValue LimitsDescription
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count

result = {
}

subscribe

New subscription

Synchronous Execution Script

Script and New subscription are executed synchronously in that order.

Request
TypeDescription
namespaceNamespaceNamespace
contentModelStoreSubscriptionContentModelStore Subscription Content Model
transactionSubscribeTransactionSubscription Status
userIdstringUser ID
ttlAtlongTime to live for GS2-Schedule trigger
Result
TypeRequiredDefaultValue LimitsDescription
Implementation Example
namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
userId = args.userId
ttlAt = args.ttlAt

result = {
}

renew

Renewal subscription

Synchronous Execution Script

Script and Renewal subscription are executed synchronously in that order.

Request
TypeDescription
namespaceNamespaceNamespace
contentModelStoreSubscriptionContentModelStore Subscription Content Model
transactionSubscribeTransactionSubscription Status
userIdstringUser ID
ttlAtlongTime to live for GS2-Schedule trigger
Result
TypeRequiredDefaultValue LimitsDescription
Implementation Example
namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
userId = args.userId
ttlAt = args.ttlAt

result = {
}

unsubscribe

Unsubscribe

Synchronous Execution Script

Script and Unsubscribe are executed synchronously in that order.

Request
TypeDescription
namespaceNamespaceNamespace
contentModelStoreSubscriptionContentModelStore Subscription Content Model
transactionSubscribeTransactionSubscription Status
userIdstringUser ID
Result
TypeRequiredDefaultValue LimitsDescription
Implementation Example
namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
userId = args.userId

result = {
}

takeOver

Subscription take over

Synchronous Execution Script

Script and Subscription take over are executed synchronously in that order.

Request
TypeDescription
namespaceNamespaceNamespace
contentModelStoreSubscriptionContentModelStore Subscription Content Model
transactionSubscribeTransactionSubscription Status
fromUserIdstringUser ID
toUserIdstringUser ID
elapsedHoursintElapsed hours since last user change
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow subscription take over
Implementation Example
namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
fromUserId = args.fromUserId
toUserId = args.toUserId
elapsedHours = args.elapsedHours

result = {
  permit=permit
}

Asynchronous Execution Script

The script executes asynchronously after the Subscription take over.

Request
TypeDescription
namespaceNamespaceNamespace
contentModelStoreSubscriptionContentModelStore Subscription Content Model
transactionSubscribeTransactionSubscription Status
fromUserIdstringUser ID
toUserIdstringUser ID
elapsedHoursintElapsed hours since last user change
Result
TypeRequiredDefaultValue LimitsDescription
Implementation Example
namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
fromUserId = args.fromUserId
toUserId = args.toUserId
elapsedHours = args.elapsedHours

result = {
}

verifyReceipt

Receipt verification

Synchronous Execution Script

Script and Receipt verification are executed synchronously in that order.

Request
TypeDescription
namespaceNamespaceNamespace
storeContentModelStoreContentModelStore Content Model
receiptReceiptReceipt
userIdstringUser ID
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow receipt verification
Implementation Example
namespace = args.namespace
storeContentModel = args.storeContentModel
receipt = args.receipt
userId = args.userId

result = {
  permit=permit
}

Asynchronous Execution Script

The script executes asynchronously after the Receipt verification.

Request
TypeDescription
namespaceNamespaceNamespace
storeContentModelStoreContentModelStore Content Model
receiptReceiptReceipt
userIdstringUser ID
Result
TypeRequiredDefaultValue LimitsDescription
Implementation Example
namespace = args.namespace
storeContentModel = args.storeContentModel
receipt = args.receipt
userId = args.userId

result = {
}