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:
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.
Last updated