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

Cancel subscription

With sub2-sdk you can directly cancel a subscription by providing its index:

const transactionReceipt: TransactionReceipt = await sub2SDK.cancelSubscription(index);

The cancellation will only go through if the account in the provided walletClient is either the subscriber or the recipient. The returned value of viem type TransactionReceipt gives information about the transaction.

Note: This performs an on-chain transaction and requires that the sub2SDK object was initialised with a walletClient.

PreviousCheck if user is a payed subscriberNextProcess payments

Last updated 11 months ago