Skip to main content

Step 4. 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 checking 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 and open the Actions section in the right pane if it’s not already open.

  2. Open the Action Flow Editor.

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

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

  5. Click UNSET to set action arguments and choose the currentProfile variable. This is the Adapty variable that holds data about the current user's profile.

  6. Fill in the fields as follows:

  • Available Options: Data Structure Field
  • Select Field: accessLevels
  • Available Options: Filter List Items
  • Filter Conditions:
    1. Select Conditions -> Single Condition and click UNSET.
    2. In the First value field, select Item in list as Source and fill in the fields as follows:
      • Available Options: Data Structure Field
      • Select Field: accessLevelIdentifier
    3. Set the filter operator to Equal to.
    4. Click UNSET next to Second value and in the Value field, enter the ID of your access level; in our example we use premium.
    5. Click Confirm and continue filling in the other fields below.
  • Available Options: Item at Index
  • List Index Options: First
  • Available Options: Data Structure Field
  • Select Field: accessLevel
  • Available Options: Data Structure Field
  • Select Field: isActive
  1. Click Confirm.

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