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
    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
    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
    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

    PaymentConductor

    PaymentConductor is Ring Platform's config-driven payment layer. One ledger (payment_transactions) and one webhook dispatcher serve store checkout, membership upgrades, news promotion, wallet credit top-up, and public pool (DAO jar) card/PayPal chip-ins.

    Browser UIs never talk to a PSP by brand for redirect — they follow Conductor CheckoutRedirect via lib/payments/checkout-redirect.ts (followCheckoutResult). Deep types: PaymentConductor architecture.

    Use Founder / Developer tabs in the docs sidebar to filter this page. Founders see configuration and business value; developers see modules, purposes, and webhook flows.

    Payment purposes

    PurposeHandlerTypical processorEntry
    store_orderhandlers/store-order.ts (+ Stripe / PayPal capture handlers)WayForPay, Stripe, credit, native token, or PayPalPOST /api/store/payments/{wayforpay|stripe|token|credit|paypal|card} → PaymentConductor.createCheckout
    membership_upgradehandlers/membership-upgrade.ts (+ Stripe / PayPal capture + Subscriptions lifecycle)WayForPay, Stripe, or PayPalCard / native via initiateMembershipPayment; PayPal via POST /api/membership/payment/paypal → SubscriptionConductor
    news_promotionhandlers/news-promotion.tsWayForPay or StripeNews promotion submit
    wallet_topuphandlers/wallet-topup.ts (+ Stripe / PayPal capture handlers)WayForPay, Stripe, or PayPalWalletConductor initiateTopUp → createCheckout
    native_token_onramphandlers/native-token-onramp.ts (+ Stripe: native-token-onramp-stripe.ts)WayForPay / Stripe (PayPal unsupported for onramp)WalletConductor initiateNativeOnramp (confidential+)
    public_pool_contributionhandlers/public-pool-contribution.tsWayForPay, Stripe, or PayPalPOST /api/public-pools/[slug]/card-checkout → desk-oracle FX → settle bumps pledged_native_token

    wallet_topup credits the fiat credit ledger (1:1 USD points) via creditBalanceService.addFiatUsd — it does not buy on-chain RING. public_pool_contribution is different: fiat charged at the PSP converts to pledged native via the Token Desk oracle (nativeUi = fiatMajor / nativePerMainCurrency) — never 1:1. See Public Pools & DAO Jars.

    What founders get

    • One payment layer — store, membership, news, wallet top-up, and DAO jar card chip-ins share the same ledger and webhook path.
    • Config-driven gateway selection — choose the card processor in ring-config.json; override per purpose via env. No code changes for PSP swaps.
    • Internal credit rail — members can pay with in-app credit (zero gateway fee when enabled).
    • Native token rail — members can spend your clone's on-chain token at store checkout (opt-in via PAYMENT_STORE_ALLOW_TOKEN=true, zero gateway fee).
    • Public pool jars — card/PayPal chip-ins convert at the desk oracle (not 1:1); see Public Pools.
    • Admin Payments tab — platform admins see a user's membership_upgrade and wallet_topup rows from the ledger (GET /api/admin/users/[id]/payments).
    • Membership PaymentModal — native-token, card, and PayPal tabs are live when NEXT_PUBLIC_PAYMENT_STORE_ALLOW_PAYPAL=true (plus PAYPAL_* + gateways.paypal.enabled). Recurring PayPal membership uses Subscriptions v1 — see SubscriptionConductor. Wallet Add Credit PayPal remains processor=paypal on wallet_topup.
    • Store PayPal — checkout method paypal → POST /api/store/payments/paypal (Orders v2) when the same public flag is on.
    • Browser handoff — UI follows redirect (navigate or form_post). WayForPay HPP must not be opened as a GET query URL.

    Gateway fee rates (ring-config.json)

    Architecture

    Implementation root: lib/payments/conductor/, lib/payments/processors/, lib/payments/payment.config.ts.

    Key modules

    ModulePathRole
    Conductorlib/payments/conductor/payment-conductor.tscreateCheckout (+ normalizeCheckoutResult), webhook entry
    Types / redirectlib/payments/conductor/types.tsCheckoutRedirect, navigate | form_post
    Client handofflib/payments/checkout-redirect.tsfollowCheckoutResult (unbranded)
    Configlib/payments/payment.config.tsgetPaymentProvider, env overrides
    WayForPay

    Related

    Related documentation

    Payments Overview

    Prerequisite: high-level rails before Conductor purpose details.

    Public Pools & DAO Jars

    Same-workflow: public_pool_contribution card jar, desk FX, and builder payout.

    WayForPay Payment Integration

    Deep-dive: WayForPay env, HMAC, and orderReference prefixes.

    PaymentConductor architecture

    Deep-dive: types, ledger, dispatcher sequences, API routes.

    PaymentConductor

    PaymentConductor is Ring Platform's config-driven payment layer. One ledger (payment_transactions) and one webhook dispatcher serve store checkout, membership upgrades, news promotion, wallet credit top-up, and public pool (DAO jar) card/PayPal chip-ins.

    Browser UIs never talk to a PSP by brand for redirect — they follow Conductor CheckoutRedirect via lib/payments/checkout-redirect.ts (followCheckoutResult). Deep types: PaymentConductor architecture.

    Use Founder / Developer tabs in the docs sidebar to filter this page. Founders see configuration and business value; developers see modules, purposes, and webhook flows.

    Payment purposes

    PurposeHandlerTypical processorEntry
    store_orderhandlers/store-order.ts (+ Stripe / PayPal capture handlers)WayForPay, Stripe, credit, native token, or PayPalPOST /api/store/payments/{wayforpay|stripe|token|credit|paypal|card} → PaymentConductor.createCheckout
    membership_upgradehandlers/membership-upgrade.ts (+ Stripe / PayPal capture + Subscriptions lifecycle)WayForPay, Stripe, or PayPalCard / native via initiateMembershipPayment; PayPal via POST /api/membership/payment/paypal → SubscriptionConductor
    news_promotionhandlers/news-promotion.tsWayForPay or StripeNews promotion submit
    wallet_topuphandlers/wallet-topup.ts (+ Stripe / PayPal capture handlers)WayForPay, Stripe, or PayPalWalletConductor initiateTopUp → createCheckout
    native_token_onramphandlers/native-token-onramp.ts (+ Stripe: native-token-onramp-stripe.ts)WayForPay / Stripe (PayPal unsupported for onramp)WalletConductor initiateNativeOnramp (confidential+)
    public_pool_contributionhandlers/public-pool-contribution.tsWayForPay, Stripe, or PayPalPOST /api/public-pools/[slug]/card-checkout → desk-oracle FX → settle bumps pledged_native_token

    wallet_topup credits the fiat credit ledger (1:1 USD points) via creditBalanceService.addFiatUsd — it does not buy on-chain RING. public_pool_contribution is different: fiat charged at the PSP converts to pledged native via the Token Desk oracle (nativeUi = fiatMajor / nativePerMainCurrency) — never 1:1. See Public Pools & DAO Jars.

    What founders get

    • One payment layer — store, membership, news, wallet top-up, and DAO jar card chip-ins share the same ledger and webhook path.
    • Config-driven gateway selection — choose the card processor in ring-config.json; override per purpose via env. No code changes for PSP swaps.
    • Internal credit rail — members can pay with in-app credit (zero gateway fee when enabled).
    • Native token rail — members can spend your clone's on-chain token at store checkout (opt-in via PAYMENT_STORE_ALLOW_TOKEN=true, zero gateway fee).
    • Public pool jars — card/PayPal chip-ins convert at the desk oracle (not 1:1); see Public Pools.
    • Admin Payments tab — platform admins see a user's membership_upgrade and wallet_topup rows from the ledger (GET /api/admin/users/[id]/payments).
    • Membership PaymentModal — native-token, card, and PayPal tabs are live when NEXT_PUBLIC_PAYMENT_STORE_ALLOW_PAYPAL=true (plus PAYPAL_* + gateways.paypal.enabled). Recurring PayPal membership uses Subscriptions v1 — see SubscriptionConductor. Wallet Add Credit PayPal remains processor=paypal on wallet_topup.
    • Store PayPal — checkout method paypal → POST /api/store/payments/paypal (Orders v2) when the same public flag is on.
    • Browser handoff — UI follows redirect (navigate or form_post). WayForPay HPP must not be opened as a GET query URL.

    Gateway fee rates (ring-config.json)

    Architecture

    Implementation root: lib/payments/conductor/, lib/payments/processors/, lib/payments/payment.config.ts.

    Key modules

    ModulePathRole
    Conductorlib/payments/conductor/payment-conductor.tscreateCheckout (+ normalizeCheckoutResult), webhook entry
    Types / redirectlib/payments/conductor/types.tsCheckoutRedirect, navigate | form_post
    Client handofflib/payments/checkout-redirect.tsfollowCheckoutResult (unbranded)
    Configlib/payments/payment.config.tsgetPaymentProvider, env overrides
    WayForPay

    Related

    Related documentation

    Payments Overview

    Prerequisite: high-level rails before Conductor purpose details.

    Public Pools & DAO Jars

    Same-workflow: public_pool_contribution card jar, desk FX, and builder payout.

    WayForPay Payment Integration

    Deep-dive: WayForPay env, HMAC, and orderReference prefixes.

    PaymentConductor architecture

    Deep-dive: types, ledger, dispatcher sequences, API routes.

    PaymentConductor

    PaymentConductor is Ring Platform's config-driven payment layer. One ledger (payment_transactions) and one webhook dispatcher serve store checkout, membership upgrades, news promotion, wallet credit top-up, and public pool (DAO jar) card/PayPal chip-ins.

    Browser UIs never talk to a PSP by brand for redirect — they follow Conductor CheckoutRedirect via lib/payments/checkout-redirect.ts (followCheckoutResult). Deep types: PaymentConductor architecture.

    Use Founder / Developer tabs in the docs sidebar to filter this page. Founders see configuration and business value; developers see modules, purposes, and webhook flows.

    Payment purposes

    PurposeHandlerTypical processorEntry
    store_orderhandlers/store-order.ts (+ Stripe / PayPal capture handlers)WayForPay, Stripe, credit, native token, or PayPalPOST /api/store/payments/{wayforpay|stripe|token|credit|paypal|card} → PaymentConductor.createCheckout
    membership_upgradehandlers/membership-upgrade.ts (+ Stripe / PayPal capture + Subscriptions lifecycle)WayForPay, Stripe, or PayPalCard / native via initiateMembershipPayment; PayPal via POST /api/membership/payment/paypal → SubscriptionConductor
    news_promotionhandlers/news-promotion.tsWayForPay or StripeNews promotion submit
    wallet_topuphandlers/wallet-topup.ts (+ Stripe / PayPal capture handlers)WayForPay, Stripe, or PayPalWalletConductor initiateTopUp → createCheckout
    native_token_onramphandlers/native-token-onramp.ts (+ Stripe: native-token-onramp-stripe.ts)WayForPay / Stripe (PayPal unsupported for onramp)WalletConductor initiateNativeOnramp (confidential+)
    public_pool_contributionhandlers/public-pool-contribution.tsWayForPay, Stripe, or PayPalPOST /api/public-pools/[slug]/card-checkout → desk-oracle FX → settle bumps pledged_native_token

    wallet_topup credits the fiat credit ledger (1:1 USD points) via creditBalanceService.addFiatUsd — it does not buy on-chain RING. public_pool_contribution is different: fiat charged at the PSP converts to pledged native via the Token Desk oracle (nativeUi = fiatMajor / nativePerMainCurrency) — never 1:1. See Public Pools & DAO Jars.

    What founders get

    • One payment layer — store, membership, news, wallet top-up, and DAO jar card chip-ins share the same ledger and webhook path.
    • Config-driven gateway selection — choose the card processor in ring-config.json; override per purpose via env. No code changes for PSP swaps.
    • Internal credit rail — members can pay with in-app credit (zero gateway fee when enabled).
    • Native token rail — members can spend your clone's on-chain token at store checkout (opt-in via PAYMENT_STORE_ALLOW_TOKEN=true, zero gateway fee).
    • Public pool jars — card/PayPal chip-ins convert at the desk oracle (not 1:1); see Public Pools.
    • Admin Payments tab — platform admins see a user's membership_upgrade and wallet_topup rows from the ledger (GET /api/admin/users/[id]/payments).
    • Membership PaymentModal — native-token, card, and PayPal tabs are live when NEXT_PUBLIC_PAYMENT_STORE_ALLOW_PAYPAL=true (plus PAYPAL_* + gateways.paypal.enabled). Recurring PayPal membership uses Subscriptions v1 — see SubscriptionConductor. Wallet Add Credit PayPal remains processor=paypal on wallet_topup.
    • Store PayPal — checkout method paypal → POST /api/store/payments/paypal (Orders v2) when the same public flag is on.
    • Browser handoff — UI follows redirect (navigate or form_post). WayForPay HPP must not be opened as a GET query URL.

    Gateway fee rates (ring-config.json)

    Architecture

    Implementation root: lib/payments/conductor/, lib/payments/processors/, lib/payments/payment.config.ts.

    Key modules

    ModulePathRole
    Conductorlib/payments/conductor/payment-conductor.tscreateCheckout (+ normalizeCheckoutResult), webhook entry
    Types / redirectlib/payments/conductor/types.tsCheckoutRedirect, navigate | form_post
    Client handofflib/payments/checkout-redirect.tsfollowCheckoutResult (unbranded)
    Configlib/payments/payment.config.tsgetPaymentProvider, env overrides
    WayForPay

    Related

    Related documentation

    Payments Overview

    Prerequisite: high-level rails before Conductor purpose details.

    Public Pools & DAO Jars

    Same-workflow: public_pool_contribution card jar, desk FX, and builder payout.

    WayForPay Payment Integration

    Deep-dive: WayForPay env, HMAC, and orderReference prefixes.

    PaymentConductor architecture

    Deep-dive: types, ledger, dispatcher sequences, API routes.

    GatewayFee %Fixed FeeCurrencyStatus
    WayForPay2.5%—UAHLive
    Stripe2.9%$0.30USDLive
    Credit Balance0%—USDLive
    RING Token0%—RINGLive
    PayPal2.9%$0.30USDLive (Orders + membership Subscriptions)

    Quick setup

    There is no WAYFORPAY_MERCHANT_ID. Use WAYFORPAY_MERCHANT_ACCOUNT. WAYFORPAY_MERCHANT_PASSWORD is required for recurring / regularApi subscription management.

    Per-purpose processor override

    Non-card rail gates

    Blank PAYMENT_*_PROCESSOR falls back to PAYMENT_DEFAULT_PROCESSOR (default wayforpay). Set it to stripe for USD-first clones.

    lib/payments/processors/wayforpay.processor.ts
    Per-purpose checkout; HPP via wayforpay-hpp.ts
    Stripelib/payments/processors/stripe.processor.tsStripe Checkout sessions (navigate)
    Internal creditlib/payments/processors/credit-balance.processor.tsCredit balance deduction
    Native tokenlib/payments/processors/native-token.processor.tsSynchronous on-chain RING → treasury
    PayPallib/payments/processors/paypal.processor.tsOrders v2 approve URL (navigate); store + wallet_topup + membership one-shot
    Webhook dispatcherlib/payments/conductor/webhook-dispatcher.tsOrders capture by purpose + PayPal Subscriptions lifecycle branch
    Purpose handlerslib/payments/conductor/handlers/*.tsFulfillment after paid (incl. membership-paypal-subscription.ts)

    PaymentProcessorId (conductor/types.ts): wayforpay | stripe | credit_balance | native-token | paypal.

    Rails

    RailDescriptionEnv gate
    merchant_redirectWayForPay / Stripe hosted checkoutDefault
    credit_balanceWallet credit balance (fiat points)PAYMENT_STORE_ALLOW_CREDIT
    native_tokenRING token on-chain to treasuryPAYMENT_STORE_ALLOW_TOKEN

    Webhook endpoints

    EndpointProvider
    /api/payments/wayforpay/webhookWayForPay (HMAC)
    /api/payments/stripe/webhookStripe (STRIPE_WEBHOOK_SECRET)
    /api/payments/paypal/webhookPayPal (transmission signature + PAYPAL_WEBHOOK_ID)

    credit_balance and native_token settle synchronously inside createCheckout (no external webhook) — the processor debits credit / transfers on-chain and marks the ledger row paid before returning.

    Store checkout routes (verified)

    RouteRailNotes
    POST /api/store/payments/wayforpaymerchant_redirectcreateCheckout({ purpose: 'store_order' }); initiateStorePayment is an internal helper inside wayforpay.processor.ts, not a ledger bypass
    POST /api/store/payments/stripemerchant_redirectStripe Checkout session
    POST /api/store/payments/tokennative_tokenRequires PAYMENT_STORE_ALLOW_TOKEN=true; isRailEnabled('store_order', 'native_token') gate
    POST /api/store/payments/creditcredit_balanceCredit balance deduction
    POST /api/store/payments/paypalmerchant_redirectOrders v2; requires PayPal credentials + gateways.paypal.enabled + public flag
    POST /api/store/payments/cardmerchant_redirectAlias of WayForPay card path

    Native token checkout (verified)

    createNativeTokenCheckout (native-token.processor.ts) resolves fiat → token via the oracle (nativeOut = amount / nativePerMainCurrency, or explicit metadata.tokenAmount), checks balance, then transferNativeTokenForUser → treasury and markPaid. Fails closed with NATIVE_TOKEN_RAIL_DISABLED, TREASURY_NOT_CONFIGURED, or INSUFFICIENT_TOKEN_BALANCE.

    Wallet top-up (verified — credits, not tokens)

    initiateCreditTopupPayment in app/_actions/wallet.ts → purpose: 'wallet_topup' → createWalletTopupWayForPay (or Stripe) → webhook handlers/wallet-topup.ts / wallet-topup-stripe.ts credits fiat USD points via creditBalanceService.addFiatUsd (1:1). This is distinct from the native_token rail: card top-up never mints on-chain RING.

    Public pool card jar (verified — desk oracle, not 1:1)

    POST /api/public-pools/[slug]/card-checkout → purpose: 'public_pool_contribution' → FX via mainCurrencyToNativeTokenUi / getNativeTokenPerMainCurrencyRate → webhook handlers/public-pool-contribution.ts → settlePublicPoolCardContribution bumps pledged_native_token and refreshes open dao_jar messages. Native SPL chip-ins stay on contributeToPool (not Conductor). Optional env: PAYMENT_PUBLIC_POOL_CONTRIBUTION_PROCESSOR. Full SSOT: Public Pools & DAO Jars.

    Membership PayPal (verified — live)

    POST /api/membership/payment/paypal → SubscriptionConductor provider paypal:

    • Recurring (default auto_subscribe) — PayPal Subscriptions v1; ledger pending → BILLING.SUBSCRIPTION.ACTIVATED → active; cancel uses paypal_subscription_id.
    • One-shot — PaymentConductor Orders v2; capture webhook uses recordPaidSubscription (never re-enters provider create).

    PaymentModal PayPal tab: components/membership/payment-modal.tsx when NEXT_PUBLIC_PAYMENT_STORE_ALLOW_PAYPAL=true. Member manage page: /membership/manage — see SubscriptionConductor.

    Wallet Add Credit PayPal still uses Orders on wallet_topup when credentials are configured.

    Database

    Apply data/migrations/004_payment_transactions.sql before production. Ledger rows use the DatabaseService result contract { success, data, error }.

    SubscriptionConductor

    Next-step: PayPal Subscriptions v1 for recurring membership.

    Wallet & Credit System

    See-also: credit top-up vs Token Desk oracle (jar FX shares desk rate).

    Ring Oracle

    Depends-on: Ring Oracle supplies desk, FX, and credit rates Conductor rails consume.

    Ring ERP

    Next-step: ERP hub cockpits after payment lands.

    Inventory & Stock

    Next-step: store paid handlers call commitSaleForOrder for stock invariant.

    Commissions & Settlements

    Same-workflow: processSettlements after paid store order.

    json
    
    {
      "payment": {
        "cardPaymentProcessor": "wayforpay",
        "supportedMethods": ["wayforpay", "credit_balance", "native_token"],
        "gateways": {
          "wayforpay": { "enabled": true, "feePercent": 2.5, "currency": "UAH" },
          "stripe": { "enabled": false, "feePercent": 2.9, "feeFixedCents": 30, "currency": "USD" }
        }
      }
    }
    bash
    
    PAYMENT_STORE_PROCESSOR=stripe
    PAYMENT_MEMBERSHIP_PROCESSOR=stripe
    PAYMENT_NEWS_PROCESSOR=wayforpay
    PAYMENT_WALLET_TOPUP_PROCESSOR=wayforpay
    bash
    
    PAYMENT_STORE_ALLOW_CREDIT=true    # spend credit points at store checkout
    PAYMENT_STORE_ALLOW_TOKEN=false    # spend native token at store checkout
    NEXT_PUBLIC_PAYMENT_STORE_ALLOW_TOKEN=false
    NEXT_PUBLIC_PAYMENT_STORE_ALLOW_PAYPAL=false
    # PAYPAL_MODE=sandbox
    # PAYPAL_CLIENT_ID=
    # PAYPAL_CLIENT_SECRET=
    # PAYPAL_WEBHOOK_ID=
    CONFIDENTIAL_TOKEN_ONRAMP=false  # confidential+ BuyNativeViaCard (native_token_onramp)
    NEXT_PUBLIC_CONFIDENTIAL_TOKEN_ONRAMP=false
    # Token Desk (credit→RING) is subscriber+ — no confidential env gate
    GatewayFee %Fixed FeeCurrencyStatus
    WayForPay2.5%—UAHLive
    Stripe2.9%$0.30USDLive
    Credit Balance0%—USDLive
    RING Token0%—RINGLive
    PayPal2.9%$0.30USDLive (Orders + membership Subscriptions)

    Quick setup

    There is no WAYFORPAY_MERCHANT_ID. Use WAYFORPAY_MERCHANT_ACCOUNT. WAYFORPAY_MERCHANT_PASSWORD is required for recurring / regularApi subscription management.

    Per-purpose processor override

    Non-card rail gates

    Blank PAYMENT_*_PROCESSOR falls back to PAYMENT_DEFAULT_PROCESSOR (default wayforpay). Set it to stripe for USD-first clones.

    lib/payments/processors/wayforpay.processor.ts
    Per-purpose checkout; HPP via wayforpay-hpp.ts
    Stripelib/payments/processors/stripe.processor.tsStripe Checkout sessions (navigate)
    Internal creditlib/payments/processors/credit-balance.processor.tsCredit balance deduction
    Native tokenlib/payments/processors/native-token.processor.tsSynchronous on-chain RING → treasury
    PayPallib/payments/processors/paypal.processor.tsOrders v2 approve URL (navigate); store + wallet_topup + membership one-shot
    Webhook dispatcherlib/payments/conductor/webhook-dispatcher.tsOrders capture by purpose + PayPal Subscriptions lifecycle branch
    Purpose handlerslib/payments/conductor/handlers/*.tsFulfillment after paid (incl. membership-paypal-subscription.ts)

    PaymentProcessorId (conductor/types.ts): wayforpay | stripe | credit_balance | native-token | paypal.

    Rails

    RailDescriptionEnv gate
    merchant_redirectWayForPay / Stripe hosted checkoutDefault
    credit_balanceWallet credit balance (fiat points)PAYMENT_STORE_ALLOW_CREDIT
    native_tokenRING token on-chain to treasuryPAYMENT_STORE_ALLOW_TOKEN

    Webhook endpoints

    EndpointProvider
    /api/payments/wayforpay/webhookWayForPay (HMAC)
    /api/payments/stripe/webhookStripe (STRIPE_WEBHOOK_SECRET)
    /api/payments/paypal/webhookPayPal (transmission signature + PAYPAL_WEBHOOK_ID)

    credit_balance and native_token settle synchronously inside createCheckout (no external webhook) — the processor debits credit / transfers on-chain and marks the ledger row paid before returning.

    Store checkout routes (verified)

    RouteRailNotes
    POST /api/store/payments/wayforpaymerchant_redirectcreateCheckout({ purpose: 'store_order' }); initiateStorePayment is an internal helper inside wayforpay.processor.ts, not a ledger bypass
    POST /api/store/payments/stripemerchant_redirectStripe Checkout session
    POST /api/store/payments/tokennative_tokenRequires PAYMENT_STORE_ALLOW_TOKEN=true; isRailEnabled('store_order', 'native_token') gate
    POST /api/store/payments/creditcredit_balanceCredit balance deduction
    POST /api/store/payments/paypalmerchant_redirectOrders v2; requires PayPal credentials + gateways.paypal.enabled + public flag
    POST /api/store/payments/cardmerchant_redirectAlias of WayForPay card path

    Native token checkout (verified)

    createNativeTokenCheckout (native-token.processor.ts) resolves fiat → token via the oracle (nativeOut = amount / nativePerMainCurrency, or explicit metadata.tokenAmount), checks balance, then transferNativeTokenForUser → treasury and markPaid. Fails closed with NATIVE_TOKEN_RAIL_DISABLED, TREASURY_NOT_CONFIGURED, or INSUFFICIENT_TOKEN_BALANCE.

    Wallet top-up (verified — credits, not tokens)

    initiateCreditTopupPayment in app/_actions/wallet.ts → purpose: 'wallet_topup' → createWalletTopupWayForPay (or Stripe) → webhook handlers/wallet-topup.ts / wallet-topup-stripe.ts credits fiat USD points via creditBalanceService.addFiatUsd (1:1). This is distinct from the native_token rail: card top-up never mints on-chain RING.

    Public pool card jar (verified — desk oracle, not 1:1)

    POST /api/public-pools/[slug]/card-checkout → purpose: 'public_pool_contribution' → FX via mainCurrencyToNativeTokenUi / getNativeTokenPerMainCurrencyRate → webhook handlers/public-pool-contribution.ts → settlePublicPoolCardContribution bumps pledged_native_token and refreshes open dao_jar messages. Native SPL chip-ins stay on contributeToPool (not Conductor). Optional env: PAYMENT_PUBLIC_POOL_CONTRIBUTION_PROCESSOR. Full SSOT: Public Pools & DAO Jars.

    Membership PayPal (verified — live)

    POST /api/membership/payment/paypal → SubscriptionConductor provider paypal:

    • Recurring (default auto_subscribe) — PayPal Subscriptions v1; ledger pending → BILLING.SUBSCRIPTION.ACTIVATED → active; cancel uses paypal_subscription_id.
    • One-shot — PaymentConductor Orders v2; capture webhook uses recordPaidSubscription (never re-enters provider create).

    PaymentModal PayPal tab: components/membership/payment-modal.tsx when NEXT_PUBLIC_PAYMENT_STORE_ALLOW_PAYPAL=true. Member manage page: /membership/manage — see SubscriptionConductor.

    Wallet Add Credit PayPal still uses Orders on wallet_topup when credentials are configured.

    Database

    Apply data/migrations/004_payment_transactions.sql before production. Ledger rows use the DatabaseService result contract { success, data, error }.

    SubscriptionConductor

    Next-step: PayPal Subscriptions v1 for recurring membership.

    Wallet & Credit System

    See-also: credit top-up vs Token Desk oracle (jar FX shares desk rate).

    Ring Oracle

    Depends-on: Ring Oracle supplies desk, FX, and credit rates Conductor rails consume.

    Ring ERP

    Next-step: ERP hub cockpits after payment lands.

    Inventory & Stock

    Next-step: store paid handlers call commitSaleForOrder for stock invariant.

    Commissions & Settlements

    Same-workflow: processSettlements after paid store order.

    json
    
    {
      "payment": {
        "cardPaymentProcessor": "wayforpay",
        "supportedMethods": ["wayforpay", "credit_balance", "native_token"],
        "gateways": {
          "wayforpay": { "enabled": true, "feePercent": 2.5, "currency": "UAH" },
          "stripe": { "enabled": false, "feePercent": 2.9, "feeFixedCents": 30, "currency": "USD" }
        }
      }
    }
    bash
    
    PAYMENT_STORE_PROCESSOR=stripe
    PAYMENT_MEMBERSHIP_PROCESSOR=stripe
    PAYMENT_NEWS_PROCESSOR=wayforpay
    PAYMENT_WALLET_TOPUP_PROCESSOR=wayforpay
    bash
    
    PAYMENT_STORE_ALLOW_CREDIT=true    # spend credit points at store checkout
    PAYMENT_STORE_ALLOW_TOKEN=false    # spend native token at store checkout
    NEXT_PUBLIC_PAYMENT_STORE_ALLOW_TOKEN=false
    NEXT_PUBLIC_PAYMENT_STORE_ALLOW_PAYPAL=false
    # PAYPAL_MODE=sandbox
    # PAYPAL_CLIENT_ID=
    # PAYPAL_CLIENT_SECRET=
    # PAYPAL_WEBHOOK_ID=
    CONFIDENTIAL_TOKEN_ONRAMP=false  # confidential+ BuyNativeViaCard (native_token_onramp)
    NEXT_PUBLIC_CONFIDENTIAL_TOKEN_ONRAMP=false
    # Token Desk (credit→RING) is subscriber+ — no confidential env gate
    GatewayFee %Fixed FeeCurrencyStatus
    WayForPay2.5%—UAHLive
    Stripe2.9%$0.30USDLive
    Credit Balance0%—USDLive
    RING Token0%—RINGLive
    PayPal2.9%$0.30USDLive (Orders + membership Subscriptions)

    Quick setup

    There is no WAYFORPAY_MERCHANT_ID. Use WAYFORPAY_MERCHANT_ACCOUNT. WAYFORPAY_MERCHANT_PASSWORD is required for recurring / regularApi subscription management.

    Per-purpose processor override

    Non-card rail gates

    Blank PAYMENT_*_PROCESSOR falls back to PAYMENT_DEFAULT_PROCESSOR (default wayforpay). Set it to stripe for USD-first clones.

    lib/payments/processors/wayforpay.processor.ts
    Per-purpose checkout; HPP via wayforpay-hpp.ts
    Stripelib/payments/processors/stripe.processor.tsStripe Checkout sessions (navigate)
    Internal creditlib/payments/processors/credit-balance.processor.tsCredit balance deduction
    Native tokenlib/payments/processors/native-token.processor.tsSynchronous on-chain RING → treasury
    PayPallib/payments/processors/paypal.processor.tsOrders v2 approve URL (navigate); store + wallet_topup + membership one-shot
    Webhook dispatcherlib/payments/conductor/webhook-dispatcher.tsOrders capture by purpose + PayPal Subscriptions lifecycle branch
    Purpose handlerslib/payments/conductor/handlers/*.tsFulfillment after paid (incl. membership-paypal-subscription.ts)

    PaymentProcessorId (conductor/types.ts): wayforpay | stripe | credit_balance | native-token | paypal.

    Rails

    RailDescriptionEnv gate
    merchant_redirectWayForPay / Stripe hosted checkoutDefault
    credit_balanceWallet credit balance (fiat points)PAYMENT_STORE_ALLOW_CREDIT
    native_tokenRING token on-chain to treasuryPAYMENT_STORE_ALLOW_TOKEN

    Webhook endpoints

    EndpointProvider
    /api/payments/wayforpay/webhookWayForPay (HMAC)
    /api/payments/stripe/webhookStripe (STRIPE_WEBHOOK_SECRET)
    /api/payments/paypal/webhookPayPal (transmission signature + PAYPAL_WEBHOOK_ID)

    credit_balance and native_token settle synchronously inside createCheckout (no external webhook) — the processor debits credit / transfers on-chain and marks the ledger row paid before returning.

    Store checkout routes (verified)

    RouteRailNotes
    POST /api/store/payments/wayforpaymerchant_redirectcreateCheckout({ purpose: 'store_order' }); initiateStorePayment is an internal helper inside wayforpay.processor.ts, not a ledger bypass
    POST /api/store/payments/stripemerchant_redirectStripe Checkout session
    POST /api/store/payments/tokennative_tokenRequires PAYMENT_STORE_ALLOW_TOKEN=true; isRailEnabled('store_order', 'native_token') gate
    POST /api/store/payments/creditcredit_balanceCredit balance deduction
    POST /api/store/payments/paypalmerchant_redirectOrders v2; requires PayPal credentials + gateways.paypal.enabled + public flag
    POST /api/store/payments/cardmerchant_redirectAlias of WayForPay card path

    Native token checkout (verified)

    createNativeTokenCheckout (native-token.processor.ts) resolves fiat → token via the oracle (nativeOut = amount / nativePerMainCurrency, or explicit metadata.tokenAmount), checks balance, then transferNativeTokenForUser → treasury and markPaid. Fails closed with NATIVE_TOKEN_RAIL_DISABLED, TREASURY_NOT_CONFIGURED, or INSUFFICIENT_TOKEN_BALANCE.

    Wallet top-up (verified — credits, not tokens)

    initiateCreditTopupPayment in app/_actions/wallet.ts → purpose: 'wallet_topup' → createWalletTopupWayForPay (or Stripe) → webhook handlers/wallet-topup.ts / wallet-topup-stripe.ts credits fiat USD points via creditBalanceService.addFiatUsd (1:1). This is distinct from the native_token rail: card top-up never mints on-chain RING.

    Public pool card jar (verified — desk oracle, not 1:1)

    POST /api/public-pools/[slug]/card-checkout → purpose: 'public_pool_contribution' → FX via mainCurrencyToNativeTokenUi / getNativeTokenPerMainCurrencyRate → webhook handlers/public-pool-contribution.ts → settlePublicPoolCardContribution bumps pledged_native_token and refreshes open dao_jar messages. Native SPL chip-ins stay on contributeToPool (not Conductor). Optional env: PAYMENT_PUBLIC_POOL_CONTRIBUTION_PROCESSOR. Full SSOT: Public Pools & DAO Jars.

    Membership PayPal (verified — live)

    POST /api/membership/payment/paypal → SubscriptionConductor provider paypal:

    • Recurring (default auto_subscribe) — PayPal Subscriptions v1; ledger pending → BILLING.SUBSCRIPTION.ACTIVATED → active; cancel uses paypal_subscription_id.
    • One-shot — PaymentConductor Orders v2; capture webhook uses recordPaidSubscription (never re-enters provider create).

    PaymentModal PayPal tab: components/membership/payment-modal.tsx when NEXT_PUBLIC_PAYMENT_STORE_ALLOW_PAYPAL=true. Member manage page: /membership/manage — see SubscriptionConductor.

    Wallet Add Credit PayPal still uses Orders on wallet_topup when credentials are configured.

    Database

    Apply data/migrations/004_payment_transactions.sql before production. Ledger rows use the DatabaseService result contract { success, data, error }.

    SubscriptionConductor

    Next-step: PayPal Subscriptions v1 for recurring membership.

    Wallet & Credit System

    See-also: credit top-up vs Token Desk oracle (jar FX shares desk rate).

    Ring Oracle

    Depends-on: Ring Oracle supplies desk, FX, and credit rates Conductor rails consume.

    Ring ERP

    Next-step: ERP hub cockpits after payment lands.

    Inventory & Stock

    Next-step: store paid handlers call commitSaleForOrder for stock invariant.

    Commissions & Settlements

    Same-workflow: processSettlements after paid store order.

    json
    
    {
      "payment": {
        "cardPaymentProcessor": "wayforpay",
        "supportedMethods": ["wayforpay", "credit_balance", "native_token"],
        "gateways": {
          "wayforpay": { "enabled": true, "feePercent": 2.5, "currency": "UAH" },
          "stripe": { "enabled": false, "feePercent": 2.9, "feeFixedCents": 30, "currency": "USD" }
        }
      }
    }
    bash
    
    PAYMENT_STORE_PROCESSOR=stripe
    PAYMENT_MEMBERSHIP_PROCESSOR=stripe
    PAYMENT_NEWS_PROCESSOR=wayforpay
    PAYMENT_WALLET_TOPUP_PROCESSOR=wayforpay
    bash
    
    PAYMENT_STORE_ALLOW_CREDIT=true    # spend credit points at store checkout
    PAYMENT_STORE_ALLOW_TOKEN=false    # spend native token at store checkout
    NEXT_PUBLIC_PAYMENT_STORE_ALLOW_TOKEN=false
    NEXT_PUBLIC_PAYMENT_STORE_ALLOW_PAYPAL=false
    # PAYPAL_MODE=sandbox
    # PAYPAL_CLIENT_ID=
    # PAYPAL_CLIENT_SECRET=
    # PAYPAL_WEBHOOK_ID=
    CONFIDENTIAL_TOKEN_ONRAMP=false  # confidential+ BuyNativeViaCard (native_token_onramp)
    NEXT_PUBLIC_CONFIDENTIAL_TOKEN_ONRAMP=false
    # Token Desk (credit→RING) is subscriber+ — no confidential env gate
    1. Docs
    2. /Features
    3. /PaymentConductor

    Updated Jul 21, 20266 min listen

    1. Docs
    2. /Features
    3. /PaymentConductor

    Updated Jul 21, 20266 min listen

    1. Docs
    2. /Features
    3. /PaymentConductor

    Updated Jul 21, 20266 min listen