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 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Β (Returns whether the user belongs to a given group. This method accepts a UserGroupModel instance, a group ID, or a group handle (string).)
- canΒ (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 β