sub2
  • sub2 protocol
  • Concepts
    • Subscription
    • Fees
    • Fee auction
    • Sponsored subscriptions
    • Processors
  • Deployments
  • SDK
    • Query subscriptions
    • Listen for incoming subscriptions
    • Listen for canceled subscriptions
    • Listen for incoming payments
    • Sponsor subscriptions
    • Check if user is a payed subscriber
    • Cancel subscription
    • Process payments
    • Query active subscriptions to recipient
    • Query active subscriptions from sender
  • Popup integration
  • Become a payment processor
  • Technical Reference
  • DAO
Powered by GitBook
On this page
  1. SDK

Check if user is a payed subscriber

It is easy with sub2 SDK to check whether a user is subscribed to a given recipient. We can simply use the isPayedSubscriber function:

const isPayedSubscriber: boolean = await sub2SDK.isPayedSubscriber(
    senderAddress, 
    recipientAddress, 
    minAmount, 
    token, 
    cooldown
);

This function will return true only if there is an active paid subscription from senderAddress to recipientAddress with minimum minAmount of token and cooldown of cooldown.

Note: This only counts paid subscriptions, meaning subscriptions that have performed at least one payment. Thus, subscriptions on the initial delay before the first payment will not count.

PreviousSponsor subscriptionsNextCancel subscription

Last updated 11 months ago