Script Trigger Reference of GS2-Money2

Reference of event triggers that call extended scripts

Trigger

deposit

Wallet balance addition

Synchronous Execution Script

The script is executed synchronously before the wallet balance addition process.

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
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

The script is executed synchronously before the wallet balance consumption process.

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
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count

result = {
}

subscribe

New subscription

Synchronous Execution Script

The script is executed synchronously before the new subscription process.

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

The script is executed synchronously before the renewal subscription process.

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

The script is executed synchronously before the unsubscribe process.

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

The script is executed synchronously before the subscription take over process.

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
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

The script is executed synchronously before the receipt verification process.

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
Implementation Example
namespace = args.namespace
storeContentModel = args.storeContentModel
receipt = args.receipt
userId = args.userId

result = {
}