Purchasely
3.7
3.7
  • Welcome page
  • General
    • Presentation
  • Quick start
    • Console Configuration
    • SDK Implementation
    • Testing
    • Sample
  • Basic configuration
    • Console Configuration
      • Creating a new application
      • Creating your Products
        • App Store
        • Play Store
        • Huawei App Gallery
        • Amazon App Store
        • Products & Plans
      • Design your Paywalls
      • Design your Paywalls-Latest
        • Carousel
        • Carousel Flow
        • Features List
        • Features List & Plan Picker with 2 & 3 columns
        • Feature list overlay
        • Plan picker horizontal
        • Plan picker with 2 and 3 Column
    • SDK installation
      • iOS SDK
      • Android SDK
      • React Native SDK
      • Cordova SDK
      • Flutter SDK
      • Unity SDK
    • SDK configurations
      • Paywall observer mode
      • Full mode
      • StoreKit 2
      • Appendices
        • Start the SDK
        • Set User Id
        • Notify when the app is ready
        • Present paywalls
        • Unlock content / service
        • Close SDK (Android only)
    • Stripe (beta)
    • Purchasely with RevenueCat
  • S2S notifications
    • Server-to-server notifications ?
    • Apple App Store
    • Google Play Store
    • Huawei App Gallery
    • Amazon App Store
  • Analytics
    • Dashboards
      • Introduction
      • Live
      • Subscriptions
      • Cohorts
      • Trials
      • Events
    • Events
      • Webhook events
        • Subscription events
        • Subscription events attributes
      • SDK events
        • UI events
        • UI attributes
  • Integrations
    • Webhook
      • Receiving and understanding messages
      • Managing entitlements
      • Detailed sequence diagrams
    • Airship
    • Batch
    • Amplitude
    • AppsFlyer
    • Adjust
    • AT Internet (Piano Analytics)
    • Branch
    • Braze
    • Clevertap
    • Customer.io
    • Firebase
    • Iterable
    • Mixpanel
    • MoEngage
    • OneSignal
    • Segment
    • Sendinblue
  • Advanced Features
    • Asynchronous paywalls
    • Anonymous user
    • Associating content
    • Audiences
    • Customising UI
      • Errors & alerts
      • Controllers (iOS) / Fragments (Android)
    • Deeplinks automations
    • Disable placements
    • Displaying users subscriptions
    • Localization
    • Lottie animations
    • Non-subscription products
    • Paywall action interceptor
    • Promoting your products
      • Self-promotion
      • Promoting In-App Purchases
    • Purchase manually
    • Subscription status
    • Use your own paywall
  • Others
    • Frequently Asked Questions
    • Migration guides
      • Migrate to Purchasely
      • Webhook
        • Migrate to Webhook v3.0
      • SDK
        • Migrate to SDK v3.0
          • v2.2.0
          • v2.1.3
        • Migrate to SDK v3.1
        • Migrate to SDK v3.2
  • TESTING
    • Testing Cycle Durations
Powered by GitBook

© Purchasely 2020-2023

On this page
  • Determining which user is concerned by the Event
  • Determining if new entitlements should be set or removed
  • Determining which entitlements shall be granted to the user
  • To Sum-up

Was this helpful?

Edit on GitHub
  1. Integrations
  2. Webhook

Managing entitlements

PreviousReceiving and understanding messagesNextDetailed sequence diagrams

Last updated 3 years ago

Was this helpful?

Determining which user is concerned by the Event

When receiving an event on the Webhook, you can parse the attributes user_id or anonymous_user_id to determine which user is concerned by the Event.

The attribute user_id will only be populated if a user identifier was set within the app, using the setUserId method of Purchasely SDK.

If the user is not signed-in inside the application, you can rely on the property anonymous_id which will be automatically populated by the Purchasely Cloud Platform.

Determining if new entitlements should be set or removed

The Event name carries the information about the event signification.

  • If the name is ACTIVATE, this means that a new purchase has been made or the subscription has renewed. The corresponding user shall be entitled.

  • If the name is DEACTIVATE, this means that the user subscription has expired. Entitlements shall thus be removed immediately.

Entitlements can be seen as an on/off switch.

Determining which entitlements shall be granted to the user

Sample payload for a user that has purchased the PURCHASELY_PLUS_MONTHLY Plan attached to the PURCHASELY_PLUS Product.

{
  "event_name": "ACTIVATE",
  "user_id": "<user id you provided through the sdk>",
  "plan": "PURCHASELY_PLUS_MONTHLY",
  "product": "PUCHASELY_PLUS",
}

To Sum-up

The following events are the ones that your backend MUST implement. They are basically a switch to lock and unlock content / service to your users.

You MUST return a HTTP 200 or HTTP 404 to tell our backend that you successfully handled the message. If you don't we will continue sending you the message following our retry strategy.

Event Name
Description

ACTIVATE

You have to give the user access to the rights of a subscription using our attributes for the specifics.

DEACTIVATE

You have to withdraw the user access to the rights of a subscription using our attributes for the specifics.

Attached to those events you will only need to look a at 2 attributes to make it work:

  • user_id or anonymous_user_id to identify the user and grant him with the access to the ressource he purchased.

  • plan to identify precisely what the user has subscribed to. You may also refer to product for more details.

Additionally to these two "transactional" events we have added over 20 events for more of a marketing purposes for you to be able to track and understand you subscribers lifecycle. We also added attributes attached to the events to ease integration and give you more context and understanding of your subscription system.

The Event is also carrying the information related to the Product and Plan purchased by the user. These object are carrying an identifier that you can set yourself in the Purchasely Console (called vendor_id see ).

You can find the full list of these events and the attributes .

Configuring Products & Plans
here
there