Trigger Reference of GS2-Money Script

createWallet

Event trigger to call GS2-Script before creating a new wallet.

Request

TypeDescription
namespaceNamespaceNamespace
walletWalletWallet

Result

TypeRequireDefaultLimitationDescription
permitboolAllow wallet creation
initialAmountint~ 2147483645Initial Wallet balance - will be credited as a free grant

Implementation Example

namespace = args.namespace
wallet = args.wallet

result = {
  permit=permit,
  initialAmount=initialAmount
}

createWalletDone

GS2-Script called after creating a new wallet.

Request

TypeDescription
namespaceNamespaceNamespace
walletWalletWallet

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
wallet = args.wallet

result = {
}

deposit

Event trigger to call GS2-Script before wallet balance is added.

Request

TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before deposit
newWalletWalletWallet after deposit
pricefloatPurchase Price
depositCountintQuantity of billable currency to be granted

Result

TypeRequireDefaultLimitationDescription
permitboolAllow wallet balance addition

Implementation Example

namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
price = args.price
depositCount = args.depositCount

result = {
  permit=permit
}

depositDone

GS2-Script called after wallet balance is added.

Request

TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before deposit
newWalletWalletWallet after deposit
pricefloatPurchase Price
depositCountintQuantity of billable currency to be granted

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
price = args.price
depositCount = args.depositCount

result = {
}

withdraw

Event trigger to call GS2-Script before wallet balance is consumed.

Request

TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before withdraw
newWalletWalletWallet after withdraw
withdrawCountintQuantity of billable currency to be consumed
paidOnlyboolOnly for paid currency

Result

TypeRequireDefaultLimitationDescription
permitboolAllow wallet balance consumption

Implementation Example

namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
withdrawCount = args.withdrawCount
paidOnly = args.paidOnly

result = {
  permit=permit
}

withdrawDone

GS2-Script called after wallet balance is consumed.

Request

TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before withdraw
newWalletWalletWallet after withdraw
withdrawCountintQuantity of billable currency to be consumed
paidOnlyboolOnly for paid currency

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
withdrawCount = args.withdrawCount
paidOnly = args.paidOnly

result = {
}