Papaya Finance Protocol
SDKProtocol
  • Introduction
  • Interaction
  • Getting Started
    • Initial Setup
    • Integration Steps
    • Go Live
  • Features
    • Real-Time Payment Streaming
    • Supported Networks
    • Business Dashboard
  • Use Cases
    • For Enterprises
    • For Financial Services
    • For Digital Economy
  • FAQ
  • Glossary
  • Future Development
  • Protocol
    • Common Methods
    • Recurring Payments
    • Subscription Methods
    • Auto Top-up
    • Liquidations
    • Fees
    • Advanced Section
      • Events
      • Subscriptions
      • Projects
      • Signatures
  • SDK
    • Installation
    • Quick Start
    • API
      • PapayaGetter
      • PapayaInteraction
      • PapayaBySigInteraction
Powered by GitBook
On this page
  1. Protocol

Recurring Payments

PreviousCommon MethodsNextSubscription Methods

Last updated 9 months ago

In traditional systems, subscription payments are automated and seamless. However, in blockchain environments, smart contracts require explicit calls to operate, posing challenges for background operations. Consequently, processing subscription payments necessitates individual calls to deduct the agreed-upon amount from each subscriber.

To address this, Papaya employs a time series mechanism. By tracking spending and earning rates per second, we can calculate user balances in real-time. Papaya represents each user through incoming and outgoing streams.

To determine the per-second token transfer rate, use the formula: Desired Value / Time (seconds). For example, to receive 30 USDT monthly, calculate as follows:

30 USDT * 1e12 / (86400 * 30.5) = 11,384,335,154,826.

Note: Economists consider each month as 30.5 days to mitigate the impact of leap years.

Despite USDT having 8 decimals, we standardize all tokens to 1e18. Therefore, upon deposit, tokens are multiplied by the appropriate factor to align with this standard.