Documentation

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    First Success Validation
    Next Steps
    Features
    Multi-Vendor Store
    Inventory & Stock
    Vendor Management
    Commissions & Settlements
    SubscriptionConductor
    PaymentConductor
    Ring Oracle
    Payments Overview
    Public Pools & DAO Jars
    WayForPay Payment Integration
    Wallet & Credit System
    WalletConductor
    Affiliate & Referral Enablement
    Referral Codes (Refcodes)
    NFT Exhibition Marketplace
    Solana NFT Gates
    Token Staking System
    Owner Project Lab
    Entities
    Opportunities
    Real-Time Messaging
    Ring Tasks
    WebRTC Calls & STUNner TURN
    Peer Games
    News Module
    Member Blogs
    Public Profile Pages
    Profile Account Widgets
    Ring File Cabinet
    Username Reservation System
    Scientific Editor
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Email AI-CRM
    Ring Mailer & RingdomX Mail
    Tunnel Protocol
    VideoConductor
    MediaConductor
    Generative Gallery
    Authentication
    Security & Compliance
    Admin console
    Admin Wiki
    Manage via Telegram
    Locale System
    Mobile Experience
    Performance Optimization Patterns
    Examples
    Quick Start
    Basic Setup
    White Label
    Custom Branding
    Web3 Integration
    Real World
    Advanced Features
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Vertical Presets (SSOT)
    Ringization playbook
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Project configuration
    Public environment variables
    Order Lab secrets
    WalletConnect Project ID (Reown Cloud)
    Supported services
    NODUS wiki (project knowledge)
    Configuration playbook
    Web3
    Token launch jurisdictions
    Wallet
    Wallet Security Tips
    Integrations
    Ethereum wallets (Wagmi v3)
    RingFileBase (object storage API)
    Ring CDN (RingFileBase edge)
    Deployment
    Self-hosted deployment
    Vercel Deployment
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Backend Services
    Firebase Integration
    Development
    Ring MCP Server

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)

    Documentation

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    First Success Validation
    Next Steps
    Features
    Multi-Vendor Store
    Inventory & Stock
    Vendor Management
    Commissions & Settlements
    SubscriptionConductor
    PaymentConductor
    Ring Oracle
    Payments Overview
    Public Pools & DAO Jars
    WayForPay Payment Integration
    Wallet & Credit System
    WalletConductor
    Affiliate & Referral Enablement
    Referral Codes (Refcodes)
    NFT Exhibition Marketplace
    Solana NFT Gates
    Token Staking System
    Owner Project Lab
    Entities
    Opportunities
    Real-Time Messaging
    Ring Tasks
    WebRTC Calls & STUNner TURN
    Peer Games
    News Module
    Member Blogs
    Public Profile Pages
    Profile Account Widgets
    Ring File Cabinet
    Username Reservation System
    Scientific Editor
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Email AI-CRM
    Ring Mailer & RingdomX Mail
    Tunnel Protocol
    VideoConductor
    MediaConductor
    Generative Gallery
    Authentication
    Security & Compliance
    Admin console
    Admin Wiki
    Manage via Telegram
    Locale System
    Mobile Experience
    Performance Optimization Patterns
    Examples
    Quick Start
    Basic Setup
    White Label
    Custom Branding
    Web3 Integration
    Real World
    Advanced Features
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Vertical Presets (SSOT)
    Ringization playbook
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Project configuration
    Public environment variables
    Order Lab secrets
    WalletConnect Project ID (Reown Cloud)
    Supported services
    NODUS wiki (project knowledge)
    Configuration playbook
    Web3
    Token launch jurisdictions
    Wallet
    Wallet Security Tips
    Integrations
    Ethereum wallets (Wagmi v3)
    RingFileBase (object storage API)
    Ring CDN (RingFileBase edge)
    Deployment
    Self-hosted deployment
    Vercel Deployment
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Backend Services
    Firebase Integration
    Development
    Ring MCP Server

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)

    Documentation

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    First Success Validation
    Next Steps
    Features
    Multi-Vendor Store
    Inventory & Stock
    Vendor Management
    Commissions & Settlements
    SubscriptionConductor
    PaymentConductor
    Ring Oracle
    Payments Overview
    Public Pools & DAO Jars
    WayForPay Payment Integration
    Wallet & Credit System
    WalletConductor
    Affiliate & Referral Enablement
    Referral Codes (Refcodes)
    NFT Exhibition Marketplace
    Solana NFT Gates
    Token Staking System
    Owner Project Lab
    Entities
    Opportunities
    Real-Time Messaging
    Ring Tasks
    WebRTC Calls & STUNner TURN
    Peer Games
    News Module
    Member Blogs
    Public Profile Pages
    Profile Account Widgets
    Ring File Cabinet
    Username Reservation System
    Scientific Editor
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Email AI-CRM
    Ring Mailer & RingdomX Mail
    Tunnel Protocol
    VideoConductor
    MediaConductor
    Generative Gallery
    Authentication
    Security & Compliance
    Admin console
    Admin Wiki
    Manage via Telegram
    Locale System
    Mobile Experience
    Performance Optimization Patterns
    Examples
    Quick Start
    Basic Setup
    White Label
    Custom Branding
    Web3 Integration
    Real World
    Advanced Features
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Vertical Presets (SSOT)
    Ringization playbook
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Project configuration
    Public environment variables
    Order Lab secrets
    WalletConnect Project ID (Reown Cloud)
    Supported services
    NODUS wiki (project knowledge)
    Configuration playbook
    Web3
    Token launch jurisdictions
    Wallet
    Wallet Security Tips
    Integrations
    Ethereum wallets (Wagmi v3)
    RingFileBase (object storage API)
    Ring CDN (RingFileBase edge)
    Deployment
    Self-hosted deployment
    Vercel Deployment
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Backend Services
    Firebase Integration
    Development
    Ring MCP Server

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)
    Ring Platform Logo

    Loading documentation...

    Preparing Ring Platform content

    Ring Platform Logo

    Loading documentation...

    Preparing Ring Platform content

    Ring Platform Logo

    Loading documentation...

    Preparing Ring Platform content

    Affiliate & Referral Enablement

    Ring Platform reconciles legacy vendor-commission scaffolding with the refcodes growth module. One attribution cookie drives two payout rails: vendors fund fiat-side referral commission through ERP settlements; the platform funds referrer token rewards via an on-chain minter. Both rails share orderReference for cross-audit.

    Executive summary

    Referrers earn tokens. Vendors fund their share of referral commission from settlement. Buyers see a referral badge at checkout when attributed. Operators approve fiat-path mints, run cron for the approved queue, and review commissions at /admin/store/commissions.

    Deep dives: Referral codes (refcodes) · Refcodes architecture · ERP commissions

    Dual-rail economics

    RailWho paysMechanismWhen it runs
    ERP (vendor-funded)Vendor net payoutcalculateCommission() → settlements.metadata.commissionBreakdown.referralCommissionPaid store order (WayForPay or credit)
    Refcodes (platform-funded)Platform treasury / mint authorityReferralRewardService → ReferralRewards.payReferral on PolygonAfter order paid (fiat: post-approval; credit: immediate)

    Both rails use resolveReferralCommissionPercent (features/store/lib/referral-commission.ts) — product override → merchant config → platform default (5%) → REFERRAL_REWARD_PERCENT env.

    Scope

    In scope: store orders and membership upgrades. Out of scope (this iteration): news promotion referrals, referee checkout discounts (referrer-only incentive).

    Dual-rail attribution and payout

    Attribution lifecycle

    1. 1

      Land with ?ref= — proxy.ts sets httpOnly ring_ref and client-readable ring_ref_visible (30 days, first-touch).

    2. 2

      Visit beacon — ReferralAttributionEffect (public layout) calls POST /api/refcodes/track; visitDaily buckets power dashboard stats (28-day retention).

    3. 3

      Signup persistence — Auth.js signIn for new users runs persistSignupReferralAttribution so users.data.referredBy survives cookie expiry (membership upgrades without a store order).

    4. 4

      Checkout — Review step shows ReferralCheckoutBadge; order APIs return referralApplied + referralCode; credit checkout shows a toast; WayForPay stashes a sessionStorage flash for the processing page.

    5. 5

      Payment success — Store webhook or credit path writes settlements (ERP rail) and referral_rewards (token rail). Membership webhook calls ReferralRewardService.onMembershipPaid when referredBy is set.

    Operator surfaces

    Referrer dashboard

    /refcodes — share links, reward history, visit stats (total / today / 7d / 28d).

    Admin refcodes

    /admin/refcodes — approve fiat rewards, batch mint, platform visit aggregates.

    Admin commissions

    /admin/store/commissions — settlement ledger, referral breakdown, process due payouts.

    Architecture

    Cookie → ledger → contract integration map and idempotency keys.

    Cross-rail audit

    Every attributed paid event should carry the same orderReference (PaymentConductor string) on:

    RecordField
    settlementsorderId / metadata
    erp_sales_assistsorderId
    referral_rewardsorderReference (unique index)
    On-chainkeccak256(orderReference) in ReferralRewards.paidOrders

    Smoke: scripts/smoke-erp-referral-pipeline.cts, scripts/smoke-growth-pipelines.cts, scripts/smoke-refcodes-http.cts (require DB_BACKEND_MODE + NODE_OPTIONS=--conditions=react-server — see scripts/run-all-smokes.sh).

    Operations checklist

    StepAction
    1. MigrationsApply 005_refcodes_schema.sql then 007_settlements_schema.sql (apply-refcodes-migrations-dev.sh, apply-erp-migrations-dev.sh).
    2. EnvFill REFERRAL CODES and CRON_SECRET in env.local.template; deploy ReferralRewards proxy; grant token mint to proxy.
    3. CronSchedule GET /api/cron/refcodes-mint with Authorization: Bearer $CRON_SECRET (up to 20 approved rewards per run).
    4. VerifyReferred order → settlements with referralCommission + erp_sales_assists + referral_rewards sharing orderReference.
    Smoke suites

    Run ./scripts/run-all-smokes.sh (sets DB_BACKEND_MODE and NODE_OPTIONS=--conditions=react-server). Targeted: smoke-erp-referral-pipeline.cts, smoke-growth-pipelines.cts, smoke-refcodes-http.cts.

    Related documentation

    Related documentation

    Referral Codes (Refcodes)

    Deep-dive: user/admin UI, contract deploy, and env vars for token rewards.

    Commissions & Settlements

    Same-workflow: vendor-funded settlement hierarchy and payout modes.

    Inventory & Stock

    Depends-on: paid commitSaleForOrder runs beside settlement on store orders.

    PaymentConductor

    Prerequisite: webhooks and orderReference contract.

    Affiliate & Referral Enablement

    Ring Platform reconciles legacy vendor-commission scaffolding with the refcodes growth module. One attribution cookie drives two payout rails: vendors fund fiat-side referral commission through ERP settlements; the platform funds referrer token rewards via an on-chain minter. Both rails share orderReference for cross-audit.

    Executive summary

    Referrers earn tokens. Vendors fund their share of referral commission from settlement. Buyers see a referral badge at checkout when attributed. Operators approve fiat-path mints, run cron for the approved queue, and review commissions at /admin/store/commissions.

    Deep dives: Referral codes (refcodes) · Refcodes architecture · ERP commissions

    Dual-rail economics

    RailWho paysMechanismWhen it runs
    ERP (vendor-funded)Vendor net payoutcalculateCommission() → settlements.metadata.commissionBreakdown.referralCommissionPaid store order (WayForPay or credit)
    Refcodes (platform-funded)Platform treasury / mint authorityReferralRewardService → ReferralRewards.payReferral on PolygonAfter order paid (fiat: post-approval; credit: immediate)

    Both rails use resolveReferralCommissionPercent (features/store/lib/referral-commission.ts) — product override → merchant config → platform default (5%) → REFERRAL_REWARD_PERCENT env.

    Scope

    In scope: store orders and membership upgrades. Out of scope (this iteration): news promotion referrals, referee checkout discounts (referrer-only incentive).

    Dual-rail attribution and payout

    Attribution lifecycle

    1. 1

      Land with ?ref= — proxy.ts sets httpOnly ring_ref and client-readable ring_ref_visible (30 days, first-touch).

    2. 2

      Visit beacon — ReferralAttributionEffect (public layout) calls POST /api/refcodes/track; visitDaily buckets power dashboard stats (28-day retention).

    3. 3

      Signup persistence — Auth.js signIn for new users runs persistSignupReferralAttribution so users.data.referredBy survives cookie expiry (membership upgrades without a store order).

    4. 4

      Checkout — Review step shows ReferralCheckoutBadge; order APIs return referralApplied + referralCode; credit checkout shows a toast; WayForPay stashes a sessionStorage flash for the processing page.

    5. 5

      Payment success — Store webhook or credit path writes settlements (ERP rail) and referral_rewards (token rail). Membership webhook calls ReferralRewardService.onMembershipPaid when referredBy is set.

    Operator surfaces

    Referrer dashboard

    /refcodes — share links, reward history, visit stats (total / today / 7d / 28d).

    Admin refcodes

    /admin/refcodes — approve fiat rewards, batch mint, platform visit aggregates.

    Admin commissions

    /admin/store/commissions — settlement ledger, referral breakdown, process due payouts.

    Architecture

    Cookie → ledger → contract integration map and idempotency keys.

    Cross-rail audit

    Every attributed paid event should carry the same orderReference (PaymentConductor string) on:

    RecordField
    settlementsorderId / metadata
    erp_sales_assistsorderId
    referral_rewardsorderReference (unique index)
    On-chainkeccak256(orderReference) in ReferralRewards.paidOrders

    Smoke: scripts/smoke-erp-referral-pipeline.cts, scripts/smoke-growth-pipelines.cts, scripts/smoke-refcodes-http.cts (require DB_BACKEND_MODE + NODE_OPTIONS=--conditions=react-server — see scripts/run-all-smokes.sh).

    Operations checklist

    StepAction
    1. MigrationsApply 005_refcodes_schema.sql then 007_settlements_schema.sql (apply-refcodes-migrations-dev.sh, apply-erp-migrations-dev.sh).
    2. EnvFill REFERRAL CODES and CRON_SECRET in env.local.template; deploy ReferralRewards proxy; grant token mint to proxy.
    3. CronSchedule GET /api/cron/refcodes-mint with Authorization: Bearer $CRON_SECRET (up to 20 approved rewards per run).
    4. VerifyReferred order → settlements with referralCommission + erp_sales_assists + referral_rewards sharing orderReference.
    Smoke suites

    Run ./scripts/run-all-smokes.sh (sets DB_BACKEND_MODE and NODE_OPTIONS=--conditions=react-server). Targeted: smoke-erp-referral-pipeline.cts, smoke-growth-pipelines.cts, smoke-refcodes-http.cts.

    Related documentation

    Related documentation

    Referral Codes (Refcodes)

    Deep-dive: user/admin UI, contract deploy, and env vars for token rewards.

    Commissions & Settlements

    Same-workflow: vendor-funded settlement hierarchy and payout modes.

    Inventory & Stock

    Depends-on: paid commitSaleForOrder runs beside settlement on store orders.

    PaymentConductor

    Prerequisite: webhooks and orderReference contract.

    Affiliate & Referral Enablement

    Ring Platform reconciles legacy vendor-commission scaffolding with the refcodes growth module. One attribution cookie drives two payout rails: vendors fund fiat-side referral commission through ERP settlements; the platform funds referrer token rewards via an on-chain minter. Both rails share orderReference for cross-audit.

    Executive summary

    Referrers earn tokens. Vendors fund their share of referral commission from settlement. Buyers see a referral badge at checkout when attributed. Operators approve fiat-path mints, run cron for the approved queue, and review commissions at /admin/store/commissions.

    Deep dives: Referral codes (refcodes) · Refcodes architecture · ERP commissions

    Dual-rail economics

    RailWho paysMechanismWhen it runs
    ERP (vendor-funded)Vendor net payoutcalculateCommission() → settlements.metadata.commissionBreakdown.referralCommissionPaid store order (WayForPay or credit)
    Refcodes (platform-funded)Platform treasury / mint authorityReferralRewardService → ReferralRewards.payReferral on PolygonAfter order paid (fiat: post-approval; credit: immediate)

    Both rails use resolveReferralCommissionPercent (features/store/lib/referral-commission.ts) — product override → merchant config → platform default (5%) → REFERRAL_REWARD_PERCENT env.

    Scope

    In scope: store orders and membership upgrades. Out of scope (this iteration): news promotion referrals, referee checkout discounts (referrer-only incentive).

    Dual-rail attribution and payout

    Attribution lifecycle

    1. 1

      Land with ?ref= — proxy.ts sets httpOnly ring_ref and client-readable ring_ref_visible (30 days, first-touch).

    2. 2

      Visit beacon — ReferralAttributionEffect (public layout) calls POST /api/refcodes/track; visitDaily buckets power dashboard stats (28-day retention).

    3. 3

      Signup persistence — Auth.js signIn for new users runs persistSignupReferralAttribution so users.data.referredBy survives cookie expiry (membership upgrades without a store order).

    4. 4

      Checkout — Review step shows ReferralCheckoutBadge; order APIs return referralApplied + referralCode; credit checkout shows a toast; WayForPay stashes a sessionStorage flash for the processing page.

    5. 5

      Payment success — Store webhook or credit path writes settlements (ERP rail) and referral_rewards (token rail). Membership webhook calls ReferralRewardService.onMembershipPaid when referredBy is set.

    Operator surfaces

    Referrer dashboard

    /refcodes — share links, reward history, visit stats (total / today / 7d / 28d).

    Admin refcodes

    /admin/refcodes — approve fiat rewards, batch mint, platform visit aggregates.

    Admin commissions

    /admin/store/commissions — settlement ledger, referral breakdown, process due payouts.

    Architecture

    Cookie → ledger → contract integration map and idempotency keys.

    Cross-rail audit

    Every attributed paid event should carry the same orderReference (PaymentConductor string) on:

    RecordField
    settlementsorderId / metadata
    erp_sales_assistsorderId
    referral_rewardsorderReference (unique index)
    On-chainkeccak256(orderReference) in ReferralRewards.paidOrders

    Smoke: scripts/smoke-erp-referral-pipeline.cts, scripts/smoke-growth-pipelines.cts, scripts/smoke-refcodes-http.cts (require DB_BACKEND_MODE + NODE_OPTIONS=--conditions=react-server — see scripts/run-all-smokes.sh).

    Operations checklist

    StepAction
    1. MigrationsApply 005_refcodes_schema.sql then 007_settlements_schema.sql (apply-refcodes-migrations-dev.sh, apply-erp-migrations-dev.sh).
    2. EnvFill REFERRAL CODES and CRON_SECRET in env.local.template; deploy ReferralRewards proxy; grant token mint to proxy.
    3. CronSchedule GET /api/cron/refcodes-mint with Authorization: Bearer $CRON_SECRET (up to 20 approved rewards per run).
    4. VerifyReferred order → settlements with referralCommission + erp_sales_assists + referral_rewards sharing orderReference.
    Smoke suites

    Run ./scripts/run-all-smokes.sh (sets DB_BACKEND_MODE and NODE_OPTIONS=--conditions=react-server). Targeted: smoke-erp-referral-pipeline.cts, smoke-growth-pipelines.cts, smoke-refcodes-http.cts.

    Related documentation

    Related documentation

    Referral Codes (Refcodes)

    Deep-dive: user/admin UI, contract deploy, and env vars for token rewards.

    Commissions & Settlements

    Same-workflow: vendor-funded settlement hierarchy and payout modes.

    Inventory & Stock

    Depends-on: paid commitSaleForOrder runs beside settlement on store orders.

    PaymentConductor

    Prerequisite: webhooks and orderReference contract.

    Multi-Vendor Store

    Prerequisite: checkout and vendor flows feed referred orders.

    Multi-Vendor Store

    Prerequisite: checkout and vendor flows feed referred orders.

    Multi-Vendor Store

    Prerequisite: checkout and vendor flows feed referred orders.

    1. Docs
    2. /Features
    3. /Affiliate & Referral Enablement

    Updated Jun 12, 20263 min listen

    1. Docs
    2. /Features
    3. /Affiliate & Referral Enablement

    Updated Jun 12, 20263 min listen

    1. Docs
    2. /Features
    3. /Affiliate & Referral Enablement

    Updated Jun 12, 20263 min listen