# Rates

## Content

* [What is rate?](#what-is-rate)
* [What are rates needed for?](#what-are-rates-needed-for)
* [How to sell rates?](#how-to-sell-rates)
* [How to control access to blocks?](#how-to-control-access-to-blocks)
* [How to control access to pages?](#how-to-control-access-to-pages)
* [Placeholder](#placeholder)
* [How to see user rate in CRM?](#how-to-see-user-rate-in-crm)
* [How to unsubscribe from rate?](#how-to-unsubscribe-from-rate)
* [How to invite and kick users from private groups?](#how-to-invite-and-kick-users-from-private-groups)

## What is rate?

Rate is a particular status that user can buy for points, stars or money (read more in payments section). For example, rates are: “Minimal”, “Standard” and “Premium”.

<figure><img src="https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2Ft0V2BYcGVhgTSncv0thg%2FGroup%2013%20(1).png?alt=media&#x26;token=bc1cdb47-5423-44b0-98e9-86c5857626fc" alt=""><figcaption></figcaption></figure>

## What are rates needed for?

Depending on the user rate you can:

* **Give access to your content** (for example, if you are selling courses or books).
* **Control access to pages** (for example, users with “Minimal” rate have access to first 10 lessons, users with “Premium” rate have access to all lessors and bonus materials).
* **Control visibility of blocks** (for example, show for premium users secret codes, materials, additional text, extra tasks, etc.).

## How to sell rates?

Rates can be sold in two ways:

* Via direct link in button, text, container, etc.\
  \
  To do this, create a link with the following content (replace placeholders):\
  `#buy-rate?rateName=RATE_NAME&description=PURCHASE_DESCRIPTION`\
  \
  Where:\
  \- `RATE_NAME`- is a name of the buying rate (spaces make sense);\
  \- `PURCHASE_DESCRIPTION` - the text will appear in invoices before the rate name.\
  \
  For example:\
  `#buy-rate?rateName=Minimal&description=Buy rate` \
  \
  Then, when the user clicks the URL, a dialog suggesting buying rate will appear:<br>

  <figure><img src="https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2FwRrCLt7e3b9JzIxpPKgt%2Fimage.png?alt=media&#x26;token=a260d09d-c9d3-49ff-b021-d18de142d6e0" alt=""><figcaption></figcaption></figure>

  <figure><img src="https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2FrGYD6OEbTi4RaqVxnAbR%2Fimage.png?alt=media&#x26;token=e5bbad77-3f43-4d36-915f-7092c1ac1a88" alt=""><figcaption></figcaption></figure>
* Via paid [page](https://tgtaps.gitbook.io/tgtaps-docs/features/pages).\
  \
  To do this, add allowed rates to the [paid page](https://tgtaps.gitbook.io/tgtaps-docs/features/pages/paid-pages):\
  ![](https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2FzbGNXP661zmyMRNFXdK5%2Fimage.png?alt=media\&token=7f980af0-1f15-47cc-aa6e-2d4737feed0d)\
  \
  Then, when user try to go to this page, the rate will be suggested to buy:\
  ![](https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2F2AAwLFqbga4NhyX5Q5wg%2Fimage.png?alt=media\&token=c89c3872-575e-432c-93b3-d60c66daafe9)

## How to control access to pages?

You can give access to [pages ](https://tgtaps.gitbook.io/tgtaps-docs/features/pages)for specified rates. To achieve this, select required rates in page configure section:

![](https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2FwyG36Y07qBZmuHq3wM9O%2Fimage.png?alt=media\&token=9f8027b2-406f-4675-b9fe-645e96d6a647)

## How to control access to blocks?

You can show some blocks to particular rates (or to free users, all users, etc.):

<figure><img src="https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2FHZrtcx7GuJ2rPDj6fjxI%2Fimage.png?alt=media&#x26;token=2339f0b8-47cc-4f10-b587-3fc041b53126" alt=""><figcaption></figcaption></figure>

If the user is not in chosen rates, the block will be hidden.

## Placeholder

To show user rate name is UI, you can use a [placeholder ](https://tgtaps.gitbook.io/tgtaps-docs/features/placeholders)in text field `{user_rate}`:

<figure><img src="https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2FktxHEOEWmXg4DloB5fFP%2Fimage.png?alt=media&#x26;token=11afffc6-cc65-463d-baeb-3e3378a0d04e" alt=""><figcaption></figcaption></figure>

In UI, here will be inserted current user rate's name.

## How to see user rate in CRM?

The rate is visible in CRM when you choose user:

<figure><img src="https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2FNXTowEnKCHIsa79R2LCw%2Fimage.png?alt=media&#x26;token=a9955d62-bc81-4f49-bc59-57f9b74c99c7" alt=""><figcaption></figcaption></figure>

## How to unsubscribe from rate?

Subscriptions to rates are the same as subscription payments. [Please read there how to cancel subscriptions](https://tgtaps.gitbook.io/tgtaps-docs/payments#subscriptions).

## How to invite and kick users from private groups?

When users buy the rate, you can approve them to join private groups and channels. When the rate is expired, you can kick them from groups automatically.

<figure><img src="https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2FirRuyWLbf3ZTNLWYZUlz%2Fimage.png?alt=media&#x26;token=d60d2c33-5828-4ef8-a171-cd6556c8a003" alt=""><figcaption></figcaption></figure>

To do so, you need to:

1. Add bot to private group or private channel.

2. Mark the bot as an administrator.\
   You can see groups where your bot is present and is admin in this tab:<br>

   <figure><img src="https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2FRCiHFEkPuKve7K2lNQaj%2Fimage.png?alt=media&#x26;token=63734340-03a3-4af0-8fc6-7036b0f943fa" alt=""><figcaption></figcaption></figure>

3. Select the group in rate groups dropdown.

4. **Generate new private invite lint with join approving,** so users can send join requests and bot can approve them <mark style="color:red;">(without this automatic approving will not work):</mark>\
   ![](https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2F0j3wrvt7wLalbX9sjlpp%2FTelegram_fk5VRKTmPi.gif?alt=media\&token=ea1e43bb-c14c-434d-b076-70ebf3fa0bf7)

5. Put the link from previous step to “rate received message”. After the user received the rate, they will receive a link and can send join request (which bot will approve):<br>

   <figure><img src="https://923504530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4Ussb0ib5NljSmRt4570%2Fuploads%2FgcHCWFdMd5UWK2VVX4CT%2FGroup%2030.png?alt=media&#x26;token=6e8110fc-5c27-4432-8ddb-48904f67af2e" alt=""><figcaption></figcaption></figure>

6. If you want to kick users when their rate expired (due to failed payment, for example), you can click the checkbox “kick when rate removed”.

**Important note:** the bot approves and rejects only new requests. If there were pending join requests or users without rates — the bot will not accept requests or kick users.

***

Something unclear in docs or you know how to improve article? [Message us in community!](https://docs.tgtaps.com/tgtaps-docs/readme/community)\
We will answer you and then promise to improve the article within 3 days.
