GS2-Money Script Trigger Reference

Reference of event triggers that call extended scripts

Trigger

createWallet

wallet creation

Synchronous Execution Script

The script is executed synchronously before the wallet creation process.

Request
TypeDescription
namespaceNamespaceNamespace
walletWalletWallet
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow wallet creation
initialAmountint
0 ~ 2147483645Initial Wallet balance - will be credited as a free grant
Implementation Example
-- Request
local namespace = args.namespace
local wallet = args.wallet

-- Business logic:
local permit = true
local initialAmount = 0

-- Result
result = {
  permit=permit,
  initialAmount=initialAmount
}

Asynchronous Execution Script

The script is executed asynchronously after the wallet creation process.

Request
TypeDescription
namespaceNamespaceNamespace
walletWalletWallet
Implementation Example
-- Request
local namespace = args.namespace
local wallet = args.wallet

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

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
pricefloatPurchase Price
depositCountintQuantity of premium currency to be granted
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow wallet balance addition
Implementation Example
-- Request
local namespace = args.namespace
local oldWallet = args.oldWallet
local newWallet = args.newWallet
local price = args.price
local depositCount = args.depositCount

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

Asynchronous Execution Script

The script is executed asynchronously after the wallet balance addition process.

Request
TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before deposit
newWalletWalletWallet after deposit
pricefloatPurchase Price
depositCountintQuantity of premium currency to be granted
Implementation Example
-- Request
local namespace = args.namespace
local oldWallet = args.oldWallet
local newWallet = args.newWallet
local price = args.price
local depositCount = args.depositCount

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

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
withdrawCountintQuantity of premium currency to be consumed
paidOnlyboolOnly for paid currency
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow wallet balance consumption
Implementation Example
-- Request
local namespace = args.namespace
local oldWallet = args.oldWallet
local newWallet = args.newWallet
local withdrawCount = args.withdrawCount
local paidOnly = args.paidOnly

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

Asynchronous Execution Script

The script is executed asynchronously after the wallet balance consumption process.

Request
TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before withdraw
newWalletWalletWallet after withdraw
withdrawCountintQuantity of premium currency to be consumed
paidOnlyboolOnly for paid currency
Implementation Example
-- Request
local namespace = args.namespace
local oldWallet = args.oldWallet
local newWallet = args.newWallet
local withdrawCount = args.withdrawCount
local paidOnly = args.paidOnly

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}