Subscription Grants
Subscription grants allow assigning user groups for when a subscription is created or deleted.Β On your Craft CMS dashboard go to Settings -> Subscription Grants
Add the following webhook (opens new window) events on your Stripe dashboard are required:
- customer.subscription.created
- customer.subscription.deleted
# Validate Grants on your templates
To check permissions on your templates you can use the following two methods:
- isInGroup (opens new window)Β (Returns whether the user belongs to a given group. This method accepts a UserGroupModel (opens new window) instance, a group ID, or a group handle (string).)
- can (opens new window)Β (Returns whether the user has a given permission, either directly or via one of its groups.)
{# isInGroup example #}
{% if currentUser.isInGroup('groupHandle') %}
{# can example #}
{% if currentUser.can('permissionName') %}
{# can example 2 #}
{% if currentUser.can("createEntries:#{section.uid}") %}
β Metered billing plan paymentForm β