Renew keys shortly before expiry
Is your feature request related to a problem? Please describe. We are using Unlock keys to gate access to the Forta API which provides threat intelligence data, but when our users purchase an Unlock key using a credit card (i.e. Crossmint) they are currently not able to automatically renew the key. Those users have to wait until the key expires, and then immediately purchase again. This can cause some short but potential downtime for those users.
Describe the solution you'd like The feature request is to be able to renew a key shortly before expiry (maybe a few days) so that downtime can be avoided.
Describe alternatives you've considered We've considered allowing more than one key per user, but this complicates things a lot. We would prefer single keys per user that can be renewed before expiry
@clemsos can you confirm that the contract will support that? Iirc we made it possible to renew slightly better expiration?
If so it should be just a pretty simple change to the worker to look at keys expiring "soon" vs just the one recently expired.
Hello @haseebrabbani , thanks for the feedback !
Currently our contract will flag a key as "renewable" if it has reached 90% of its total expiration time (see the lines below). One can check if a key can be renewed by calling isRenewable directly on the contract.
https://github.com/unlock-protocol/unlock/blob/8d422f7d80444525842aceeb391564892bada419/smart-contracts/contracts/mixins/MixinPurchase.sol#L197-L200
Does the issue only happen with credit card? Or also with crypto subscriptions?
@clemsos Can you look and see if we can update our scripts so that renewals (both crypto and cards) are kicked at 90% instead of 100%? This will avoid any "downtime", correct?
thanks @clemsos! I was not aware of the 90% expiration window. Since there is currently no automatic renewal support for credit cards (Crossmint), it's a bigger issue for credit card users. It's not as big an issue for users who pay with crypto where it can renew automatically if there is enough approved balance