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

Popup integration

Sub2 offers easy checkout integration with a popup window. It works by opening a URL starting with www.sub2protocol.com/popup followed by URL arguments. This makes it possible to create a custom button or other HTML elements on your website while still preserving all functionality in a separate window. The list of arguments can be seen here:

Parameter
Details

recipient

Address of the recipient of the subscription payments.

cooldown

Number of seconds between payments. For example, 30 days is cooldown=2592000.

token

Address of ERC-20 token that is paid with.

amount

Amount of tokens paid each time. This is the actual decimal number e.g. amount=10.5 and not the EVM integer version.

processing_fee_token

Address of the ERC-20 token used for processing fee.

max_processing_fee

Amount of maximum processing fee. This is the actual decimal number e.g. max_processing_fee=0.02 and not the EVM integer version.

auction_duration

Duration of the auction period in seconds. This has to be less than or equal to cooldown.

initial_delay

Delay in seconds before the first payment is due.

initial_payments

Number of initial payments with the creation of the subscription. If initial_delay > 0 then no initial payments are made.

sponsor

Address of sponsor of the subscription.

sponsor_signature

EIP-712 signature of sponsor permit. The permit has to contain the same parameters as given in the URL.

permit_nonce

Nonce of the sponsor permit used for the signature.

permit_deadline

UNIX time in seconds for when the provided sponsor signature will expire.

The parameters sponsor, sponsor_signature, permit_nonce and permit_deadline should only be provided if there is an intention to sponsor the processing fee of the subscription. However, if there is an intention of making a sponsorship, all of these parameters should be provided.

Note that there is no field for sender/subscriber. This is because the user should be able to chose which account they want to pay the subscription with.

PreviousQuery active subscriptions from senderNextBecome a payment processor

Last updated 11 months ago