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

Process payments

The sub2-sdk allows you to process payments of a batch of subscriptions.

const transactionReceipt: TransactionReceipt = await sub2SDK.processBatch(indices, feeRecipient);

Here indices is of type bigint[] and specifies the indices of subscriptions to process. The feeRecipient is of type 0x${string} and is the address that the processing fee will be sent to. The returned value of viem type TransactionReceipt gives information about the transaction.

The transaction sent by processBatch will not revert if any of the individual subscriptions fail to be processed. This means that the processing of the other subscriptions will still go through.

Note: A payment of a subscription will only be processed if the subscription is in auction mode!

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

PreviousCancel subscriptionNextQuery active subscriptions to recipient

Last updated 11 months ago