QBitFlow Documentation

    Complete guide to integrating cryptocurrency payments with QBitFlow

    Allowances, Max Amount & Pricing

    Understanding how allowances, max amounts, and pricing work in QBitFlow is essential for managing subscriptions effectively.

    What is an Allowance?

    Authorized Amount, Not Escrow

    An allowance is the amount a customer authorizes QBitFlow smart contracts to pull from their wallet for subscription billing. This is NOT an escrow - the customer keeps their funds in their wallet. They simply authorize the smart contract to pull up to this amount over time.

    How Allowances Work

    When creating a subscription, the customer selects how many billing periods they want to authorize (e.g., 3 months, 6 months, 12 months)

    The required allowance is calculated automatically: price × periods × (1 + buffer)

    The customer signs one transaction to approve this allowance

    On each billing cycle, the smart contract automatically pulls the exact amount due

    The allowance decreases with each billing but funds remain in customer's wallet until billed

    Allowance Safety

    Allowances are Safe and Controlled

    The allowance cannot be pulled at once. Smart contracts enforce:

    • Billing frequency (can't bill more often than agreed)
    • Exact amount per billing cycle (can't exceed agreed price)
    • Customer can cancel anytime to stop future billings
    • All rules are enforced on-chain and verifiable

    Example Allowance Calculation

    Subscription Price:$99.99 USD/month
    Customer Chooses:6 months
    Selected Currency:USDC
    Required Allowance:~620 USDC

    * Includes buffer for price fluctuations

    MaxSpending, MaxAmount & Num Periods Explained

    Understanding these three concepts is crucial for properly managing subscriptions and controlling costs.

    MaxSpending (PAYG Subscriptions)

    Definition: A limit in USD set by the user defining the maximum amount they're willing to spend on a pay-as-you-go (PAYG) subscription.

    Purpose:

    • Helps control spending on usage-based services
    • Prevents unexpected charges from high usage
    • Gives users peace of mind with predictable costs

    Example:

    If you set MaxSpending to $500 for an API service PAYG subscription, you won't be charged more than $500 total, regardless of your actual usage. Once the limit is reached, the service may be paused until you increase the limit or the next billing cycle.

    MaxAmount (All Subscriptions)

    Definition: Used to handle price fluctuations in cryptocurrency values, ensuring individual payments don't exceed a reasonable threshold.

    For Regular Subscriptions:

    • Set as a percentage of subscription price at creation time
    • Accommodates reasonable price changes in crypto markets
    • Can be updated later if needed

    For PAYG Subscriptions:

    • Set as a percentage of MaxSpending amount
    • Ensures individual payments don't exceed a threshold relative to overall spending limit
    • Protects against sudden crypto price drops

    Example:

    For a $100/month subscription, MaxAmount might be set to 120 USDC (20% buffer). If the price of USDC drops and would require 130 USDC (equivalent to $100 at the time of payment), the transaction will be blocked until the user updates MaxAmount, protecting them from excessive charges.

    USDC is designed to be stable and closely match the USD value, so the amount of USDC needed for a $100 subscription should remain consistent. However, for other tokens/native currencies like ETH or SOL, their prices can fluctuate significantly. This means the number of tokens required to cover the USD subscription price may vary over time. MaxAmount acts as a safeguard to prevent unintended or unexpectedly large charges if the token price drops.

    Num Periods (Subscription Creation)

    Definition: Used when creating subscriptions to automatically compute and set the allowance based on the subscription price and number of periods specified.

    Purpose:

    • Streamlines subscription setup by pre-calculating allowance
    • Defines how many billing cycles the customer authorizes upfront
    • Reduces friction - users don't manually calculate required allowance

    How It Works:

    Allowance = Price × NumPeriods × (1 + Buffer)

    If subscription is $99.99/month and user selects 6 periods, the system automatically calculates the required allowance (≈ $620 with buffer) and prompts the user to approve it.

    Comparison: When to Use What

    ConceptUsed ForPurposeWho Sets It
    MaxSpendingPAYG SubscriptionsControl total spendingUser/Customer
    MaxAmountAll SubscriptionsHandle crypto price volatilitySystem (with buffer)
    Num PeriodsSubscription CreationCalculate initial allowanceUser/Customer

    What is Max Amount?

    Protection Against Price Volatility

    The max amount is a safety limit on how much cryptocurrency can be charged per billing cycle. Since subscription prices are in USD but paid in crypto, if the crypto price drops significantly, more tokens would be needed. The max amount prevents unexpectedly large charges.

    Why Max Amount Exists

    Problem: Crypto Price Volatility

    A $100 subscription might normally cost 100 USDC. But if USDC depegs to $0.90, it would need 111 USDC. Without a limit, customers could be charged unexpectedly high amounts.

    Solution: Max Amount Cap

    The max amount is set when creating the subscription (e.g., 120 USDC). The smart contract will never pull more than this per billing cycle, even if prices fluctuate.

    What Happens When Max Amount is Reached?

    1. 1.

      Subscription Status Changes

      The subscription status changes to

      pending

    2. 2.

      Customer Must Update

      Customer must visit the subscription management page and increase the max amount

    3. 3.

      Grace Period

      Customer has a grace period to update. If not updated in time, subscription is cancelled

    4. 4.

      Your Action

      Send urgent notification to customer with link to management page

    Pricing in USD

    Stable Pricing for Merchants

    All product prices in QBitFlow are set in USD. When a customer pays, QBitFlow automatically converts the USD price to the customer's selected cryptocurrency at the current exchange rate. This gives you predictable revenue while customers can pay in their preferred crypto.

    How Price Conversion Works

    1

    You Set USD Price

    Create a product with price: $99.99

    2

    Customer Selects Cryptocurrency

    Customer chooses to pay in ETH, USDC, SOL, etc.

    3

    Automatic Conversion

    QBitFlow fetches current exchange rate and calculates equivalent amount in selected crypto

    4

    Customer Pays

    Customer pays the converted amount in their chosen cryptocurrency

    Best Practices

    📧 Notify on Low Allowance

    When subscription status is "low_on_funds", send a friendly reminder email to customer with link to increase their allowance.

    🚨 Alert on Max Amount Issues

    When status is "pending" (max amount reached), send urgent notification. This requires immediate customer action to avoid cancellation.

    📊 Monitor Crypto Prices

    If you notice significant crypto price drops, consider proactively notifying customers about potential max amount issues before they occur.

    💡 Key Takeaway: Allowances keep funds in the customer's wallet while enabling automated billing. Max amounts protect customers from price volatility. USD pricing gives you predictable revenue. These three features work together to create a secure, user-friendly subscription experience.