# Subscription or Membership Fee (Unlock Protocol)

**Overview**

Hats has integrated with Unlock Protocol to allow organizations to set up recurring subscriptions or one-time membership fees for roles. When you add a subscription or membership fee to a role, a unique claim page is automatically generated for fee collection and onboarding.

Once a subscription or membership is active, the new member immediately gains all associated role powers, such as access to workspaces, communication channels, and voting rights. If the subscription is canceled or expires, access is automatically revoked.

The module's code is open source and is available [here](https://github.com/Hats-Protocol/unlock-eligibility).

### **Video guide** <a href="#adding-the-module-to-a-hat" id="adding-the-module-to-a-hat"></a>

{% embed url="<https://www.loom.com/share/3213807bf3ed4b00a6e856a59a5661eb>" %}

### **Adding the module to a hat** <a href="#adding-the-module-to-a-hat" id="adding-the-module-to-a-hat"></a>

* Go to the tree that includes the hat you wish to create the module for
* Select "Edit Tree"
* Locate and select the hat
* Open the "Revocation & Eligibility" section

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2FOka4bRal8kUyzgrRIHN8%2FScreenshot%202024-10-22%20at%204.02.30%20PM.png?alt=media&#x26;token=4d05aa80-6274-4389-a1c8-7b8ef3c29826" alt=""><figcaption></figcaption></figure>

* Choose "Add Module". This will open the module creation form
* Choose "Subscription Eligibility (Unlock Protocol v14)" in the module type

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2FfQpU5uSG39dXDSeixTm0%2FScreenshot%202024-10-22%20at%204.03.09%20PM.png?alt=media&#x26;token=b605a250-9c5e-4c92-b877-27f8d3060852" alt=""><figcaption></figcaption></figure>

* Fill in the module-specific parameters, shown below.
  * **Withdrawing funds:** the Lock Manager address will be authorized to withdraw funds via [app.unlock-protocol.com/locks<br>](https://app.unlock-protocol.com/locks).
  * **One-time purchase:** Turn the subscription into a one-time purchase by setting the subscription period to 10 or more years
* Choose "Deploy & Return" to deploy the module and return to the hat edit form. The module address will be automatically updated on the hat's eligibility property in the form. Once you deploy these changes, the hat's eligibility will be updated.

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2FgCEX49TqYcyVzaXZNxS7%2FScreenshot%202024-10-22%20at%204.06.34%20PM.png?alt=media&#x26;token=1f885f34-8c08-495d-bcbf-437ebcca6294" alt=""><figcaption></figcaption></figure>

**ONE MORE IMPORTANT STEP!** Copy the address that has now appeared in the hat's eligibility address as shown below. This is the address of the module you just deployed.&#x20;

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2FlEGKDTZHa64I0Js9q5yk%2FScreenshot%202024-10-23%20at%204.13.12%20PM.png?alt=media&#x26;token=0fc0e469-ecb1-4725-84cb-34097c48c9d0" alt=""><figcaption></figcaption></figure>

Next, mint any hat that is an admin of the subscription-connected hat to this address. Do so by adding the module address you copied as a wearer of an admin hat (you may have to increase the max supply of this admin hat), and click save.

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2FSqtT3t6ZloCaEeU7M0Fz%2FScreenshot%202024-10-23%20at%204.16.58%20PM.png?alt=media&#x26;token=b5493f8a-cf1b-4103-aec4-35c6c2199241" alt=""><figcaption></figcaption></figure>

Finally, deploy all your changes onchain.

### Sharing the Subscription/Fee Payment Page <a href="#viewing-the-hats-eligibility-criteria" id="viewing-the-hats-eligibility-criteria"></a>

Once deployed, exit from edit mode and return to the hat that you have added this subscription eligibility module to. In the hat's details, you will now see a "Pay the subscription" link.

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2Fo6KZqfOU2We0LfTUZqBM%2FScreenshot%202024-10-22%20at%204.10.13%20PM.png?alt=media&#x26;token=2bcf1959-2cb0-464f-8c98-c8fc833411ac" alt=""><figcaption></figcaption></figure>

Follow this link to see a unique claim page that is automatically generated for fee collection and onboarding.

Once a subscription or membership is active, the new member automatically claims the hat and immediately gains all associated role powers, such as access to workspaces, communication channels, and voting rights. If the subscription is canceled or expires, access is automatically revoked.

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2FaL2qylJ7HzkuvTZfXz54%2Fimage.png?alt=media&#x26;token=917b08de-49e0-46d1-a22b-5c9423c239e2" alt=""><figcaption></figcaption></figure>

### Withdrawing Collected Fees <a href="#viewing-the-hats-eligibility-criteria" id="viewing-the-hats-eligibility-criteria"></a>

Subscription or membership fees collected by the claim page above can be collected by visiting the Unlock Protocol app at <https://app.unlock-protocol.com/locks>, connecting your wallet, and withdrawing funds, as shown below.&#x20;

Unlock Protocol and Hats Protocol take a combined 1% protocol and 5% referral fee, respectively, to support the cost of development.

<figure><img src="https://4112750745-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYVrI6eFo60Gwsn2A05qA%2Fuploads%2Fq0ULbYZyyrkMrEWJGBFz%2FScreenshot%202024-10-24%20at%201.18.18%20PM.png?alt=media&#x26;token=302b13ea-c18e-4d89-9395-21b7e4d6b097" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hatsprotocol.xyz/hats-integrations/eligibility-and-accountability-criteria/subscription-or-membership-fee-unlock-protocol.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
