Skip to main content

Coin Packages

Defines purchasable coin packages for sweepstakes brands. Each package specifies a price and the amount of Gold Coins (GC) and Sweepstakes Coins (SC) the player receives.

Relationships

Columns

ColumnTypeNullableDefaultDescription
iduuidNOgen_random_uuid()Primary key
brand_iduuidNOFK to brands. Which brand this package belongs to.
namevarchar(100)NODisplay name shown to players in the store
system_namevarchar(100)NOInternal identifier used in code and APIs
descriptiontextYESMarketing description for the package
price_amountnumeric(18)NOPurchase price
price_currencyvarchar(10)NO'USD'Currency for the price (e.g., USD, EUR)
gc_amountnumeric(18)NOGold Coins granted on purchase
sc_amountnumeric(18)NO0Sweepstakes Coins granted on purchase (the "free" promotional component)
badgevarchar(50)YESBadge text displayed on the package (e.g., "Best Value", "Popular")
badge_stylevarchar(50)YESCSS class/style for badge display (e.g., badge-yellow, badge-blue, badge-red). Handled by frontend.
image_urlvarchar(500)YESPackage thumbnail image URL
banner_urlvarchar(500)YESPackage banner image URL (for featured/promoted packages)
sort_orderintegerNO0Legacy ordering field
display_priorityintegerNO0Primary sort field. Higher numbers appear first. Smartico packages should have highest priority.
is_activebooleanNOtrueWhether the package is currently available for purchase
starts_attimestamptzYESWhen the package becomes available. NULL = available immediately.
expires_attimestamptzYESWhen the package expires. NULL = never expires.
available_countriestext[]YESArray of country codes where the package IS available. NULL = all countries.
restricted_countriestext[]YESArray of country codes where the package is NOT available
restricted_statestext[]YESArray of US state codes where the package is NOT available (e.g., WA, ID, NV, MT for sweepstakes compliance)
package_sourcevarchar(20)NO'standard'Source/type of package. See values below.
availability_unitvarchar(10)YESTime unit for limited availability (e.g., hour, day)
availability_valueintegerYESNumber of time units for limited availability
created_attimestamptzNOCURRENT_TIMESTAMPRecord creation timestamp
updated_attimestamptzNOCURRENT_TIMESTAMPLast update timestamp

Package Source Values

ValueDescription
standardRegular packages created by the brand admin
smarticoPersonalized offers pushed via the Smartico CRM integration
affiliate_hiddenHidden packages accessible only via affiliate/promotional links
unrestrictedPackages available to all players regardless of assignment rules

Key Indexes

IndexColumnsNotes
coin_packages_pkeyidPrimary key
idx_coin_packages_brand_activebrand_id, is_activeActive packages per brand
idx_coin_packages_brand_active_sourcebrand_id, is_active, package_sourcePartial: WHERE is_active = true
idx_coin_packages_display_prioritydisplay_priority DESCStore ordering
idx_coin_packages_sourcepackage_sourceFilter by source type
idx_coin_packages_system_namesystem_nameLookup by internal name
idx_coin_packages_starts_atstarts_atTime-based availability
idx_coin_packages_expires_atexpires_atExpiration filtering

Business Rules

  • Packages use a "purchase GC, get free SC" sweepstakes model for legal compliance
  • restricted_states is critical for US sweepstakes law compliance (certain states prohibit sweepstakes)
  • When a player purchases a package, a snapshot of the package details is stored in coin_package_purchases for audit purposes
  • Smartico packages are assigned to specific players via coin_package_player_assignments
  • The availability_unit + availability_value fields allow time-limited offers (e.g., "available for 24 hours after assignment")
  • VIP players may receive additional coins via the store_multiplier in vip_levels