Skip to content

feat(wallet): Integrate bavix/laravel-wallet for donation wallet balances, Silk purchases, and future crypto withdrawals #30

Description

@Devsome

Motivation

Currently, silkpanel‑cms handles donations by rewarding players with Silk (in‑game currency) based on predefined packages and depends on the silkpanel.version (VSRO or ISRO). We want to introduce a real‑money wallet system that allows:

  • Donation packages to optionally credit a wallet balance (in fiat currency, e.g., USD or EUR) in addition to or instead of Silk.
  • Players to use that wallet balance to purchase Silk directly – giving them flexibility and transparency about the real‑world value.
  • Administrators to control the entire wallet feature via global settings (enable/disable, fee percentages, etc.).
  • A future path for players to withdraw wallet funds via cryptocurrency (with a configurable platform fee).

To achieve this without reinventing the wheel, we will integrate the well‑tested bavix/laravel-wallet package. It provides multi‑wallet support, transaction history, and is easily extendable.

Proposed solution

  1. Integration of bavix/laravel-wallet

    • Require and configure the package in silkpanel‑cms.
    • Each user gets a default wallet (in a fiat currency, configurable globally as wallet_currency, e.g., USD or EUR).
    • The wallet supports standard deposit and withdrawal operations, with full transaction history.
  2. Donation package creation (Filament admin)

    • When creating or editing a Donation Package, the admin will see:
      • The existing Silk‑type selection (isro/vsro).
      • A new toggle “Credit wallet balance”.
      • If the toggle is enabled, a required numeric input “Wallet amount” (the fiat value, e.g., 10.00).
    • Multiple configurations are NOT possible: a package can grant only Silk or only wallet credit.
  3. Global feature toggle & settings (Page Settings)

    • A new section “Wallet” in the admin Page Settings with:
      • wallet_enabled: boolean (default false).
      • wallet_currency: select (USD or EUR).
      • wallet_withdrawal_enabled: boolean (default false – for future use).
      • wallet_withdrawal_fee_percent: float (e.g., 5.0 for 5% platform fee, visible but greyed out if withdrawals are disabled).
  4. Frontend profile page

    • When the wallet feature is globally enabled, a new navigation item “Wallet” appears in the user profile area.
    • The wallet page shows:
      • Current wallet balance (formatted with currency symbol).
      • Transaction history (deposits from donations, purchases of Silk, later withdrawals) with date, amount, and type.
    • The purchase of Silk via wallet is a separate action (can be a button “Buy Silk” that opens a modal or dedicated page) – the exact UX will be detailed later.
  5. Future: crypto withdrawals (informational)

    • Not part of this initial implementation, but the architecture should support adding withdrawal functionality later.
    • When enabled, a user can request a crypto payout. The amount sent to the player will be (wallet balance) - (fee %). The fee goes to the platform’s wallet.
    • The withdrawal provider (e.g., Coinbase Commerce, NOWPayments) will be selected in a subsequent phase.

Acceptance criteria

  • The bavix/laravel-wallet package is installed and configured successfully.
  • In the Filament Donation Package form, admins can toggle wallet crediting and specify a fiat amount.
  • After a successful donation, the user's wallet balance increases by the specified amount (if the wallet feature is globally enabled). The transaction appears in the wallet history.
  • Silk-only packages continue to work unchanged; wallet credit is optional and backward‑compatible.
  • Global settings correctly enable/disable the wallet feature and set the currency.
  • The user profile shows a wallet page with balance and transaction history only when the feature is globally enabled.
  • If the wallet feature is disabled, no wallet‑related UI or logic is active anywhere in the frontend or admin (except the settings themselves).
  • All monetary values are stored as integers (minor units) internally and displayed with proper formatting.

Out of scope

  • Detailed design of the “Buy Silk with wallet” UI (will be a separate ticket).
  • Implementation of cryptocurrency withdrawals and their integration with a payment provider.
  • Exchange rates between fiat and Silk – initially Silk purchase from wallet is assumed to be a fixed rate defined elsewhere.
  • Migration of existing donation packages (they will simply have the wallet toggle off by default).
  • Admin panel dashboard widgets for wallet statistics.

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions