Skip to main content

Step 5. Check access to paid content

When determining if a user has access to specific paid content, you'll need to verify their access level. This means checking if the user has at least one access level, and if that level is the required one.

You can do this by looking at the user profile, which contains all available access levels.

Now, let’s allow users to purchase your product:

  1. Double-click the button that should show the paid content.

  2. Open the Actions section in the right pane if it’s not already open.

  3. Open the Action Flow Editor.

  4. In the Select Action Trigger window, choose On Tap.

  5. In the No Actions Created window, click the Add Conditional Action button.

  6. In the Actions Flow Editor window, choose Combine Conditions.

  1. In the Set Actions Arguments section, choose currentProfile variable. This is the Adapty variable that holds data about the current user's profile.

  2. Fill in the fields as follows:

ParameterValue
Available OptionsData Structure Field
Select FieldaccessLevels
Available OptionsFilter List Items
Filter ConditionsConditions -> Single Condition
  1. In the Filter Conditions field, click UNSET.

  2. In the Set Variable window, click Conditions -> Single Condition.

  3. In the new Set Variable window, click UNSET next to First value.

ParameterValue
First ValueItem in List
Available OptionsData Structure Field
Select FieldaccessLevelIdentifier
  1. Click Confirm.

  2. In the Set Variable window, click UNSET next to Second value.

  3. In the Value field, enter the ID of your access level, in our example we use premium.

  4. Click Confirm.

  5. In the new Set Variable window where you returned, fill in the fields as follows:

ParameterValue
Available OptionsItem as Index
List Index OptionsFirst
Available OptionsData Structure Field
Select FieldaccessLevels
Available OptionsData Structure Field
Select FieldisActive
  1. Click the Confirm button twice.

Now, add the actions for what happens next — if the user has the right subscription or not. Either take them to the next page or show the paywall so they can buy access.