unlock icon indicating copy to clipboard operation
unlock copied to clipboard

Renew keys shortly before expiry

Open haseebrabbani opened this issue 1 year ago • 2 comments

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

haseebrabbani avatar Feb 21 '24 14:02 haseebrabbani

@clemsos can you confirm that the contract will support that? Iirc we made it possible to renew slightly better expiration?

julien51 avatar Feb 28 '24 16:02 julien51

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.

julien51 avatar Feb 28 '24 16:02 julien51

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 avatar Mar 05 '24 13:03 clemsos

@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?

julien51 avatar Mar 08 '24 14:03 julien51

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

haseebrabbani avatar Mar 11 '24 06:03 haseebrabbani