Entitlements

Entitlements are used when you want to grant your customers access based on their purchases. For example if your basic subscription grants access to basic features, basic reporting and basic support you would create three entitlements for these and connect them to the basic subscription product. Whenever a customer then purchases this product Upodi will send Webhooks to your system informing about the new entitlements for the customer purchasing.

Also if for some reason the subscription stops - the customer unsubscribes, pauses the subscription or switches the plan from basic to advanced - then Upodi will send you new webhooks containing the changes in access rights to be granted to the customer.

Get started with Entitlements

Step 1: Create entitlements

You can create codes that represent an access which you want to grant on any of your products here in the Entitlements section of your product plan creation.

These can also be created in the API:

curl --request POST \
     --url https://api-front.upodi.io/Entitlements \
     --header 'Authorization: Bearer {ApiKey}' \
     --header 'X-version: {version}' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "FullName": "basic module access",
  "Code": "100-101"
}
'

Step 2: Add the entitlements to your product

On a product you can assign the newly created entitlement. Find a product and head to the entitlements tab:

1208

Enable or disable them by clicking them. The product plan has to be inactive to make these changes.

You can also do it via the API:

curl --request PUT \
     --url https://api-front.upodi.io/ProductPlans/charges/{productPlanChargeID}/entitlements \
     --header 'Authorization: Bearer {ApiKey}' \
     --header 'X-version: {version}' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "EntitlementIDs": [
    "{EntitlementID}"
  ]
}
'

👍

Changes to Entitlements

Be aware that if you assign new entitlements or edit already assigned ones it would potentially send webhooks for the changes to entitlements for the customers

Step 3: Listen to webhooks for entitlements

Subscribe for webhooks on a chosen URL:

curl --request POST \
     --url https://api-front.upodi.io/Webhooks \
     --header 'Authorization: Bearer {ApiKey}' \
     --header 'X-version: {version}' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "EventNotificationEnum": "288230376151711744",
  "Url": "https://mysystem.com/entitlements",
  "FullName": "entitlements notifications"
}
'

👍

Flagged enums

288230376151711744 is the flagged enum to subscribe to just the webhooks related to entitlements. See more about this in Webhooks.

You can also just go to the webhooks section of Upodi and configure a webhook to where you'd like to be notified.

Find them by customer instead

Alternatively to implementing webhooks you can also just retrieve a customers' entitlements:

curl --request GET \
     --url https://api-front.upodi.io/Customers/{CustomerID}/entitlements \
     --header 'Authorization: Bearer {ApiKey}' \
     --header 'X-version: {version}' \
     --header 'accept: application/json'

This will give you a list of that customers' entitlements.