addPaymentMethod
Export, to add payment method without a config.
PaymentMethodDefinition payload
---@meta
---@class PaymentMethodDefinition
---@field icon string
---@field balance fun(source): number
---@field remove fun(source, amount, reason): boolean
---@field add fun(source, amount, reason): boolean Export
---**`server`**
---@param key string
---@param payload PaymentMethodDefinition
---@return boolean
function exports.fd_shops:addPaymentMethod(key, payload) end Example
This adds society payment method for qbox framework and our fd_banking. Snippet by @IgnoranceIsBliss<939557396701909012>
exports.fd_shops:addPaymentMethod('society', {
icon = 'fas fa-bank',
balance = function(source)
local ply = exports.qbx_core:GetPlayer(source)
if not ply then return false end
local society = ply.PlayerData.job.name
return exports.fd_banking:GetAccount(society)
end,
remove = function(source, amount, reason)
local ply = exports.qbx_core:GetPlayer(source)
if not ply then return false end
local society = ply.PlayerData.job.name
return exports.fd_banking:RemoveMoney(society, amount, reason)
end,
add = function(source, amount, reason)
local ply = exports.qbx_core:GetPlayer(source)
if not ply then return false end
local society = ply.PlayerData.job.name
return exports.fd_banking:AddMoney(society, amount, reason)
end,
})