Skip to main content
Solved

Granting Entitlements API not functioning as expected

  • February 1, 2025
  • 1 reply
  • 74 views

Forum|alt.badge.img+4

Our user journey may allow users to experience multiple trials of our subscription product. We are using the RevenueCat API to grant users an entitlement for a custom time frame. Unfortunately after one successful request, subsequent requests no longer create a new entitlement for the user. Instead it returns successfully with the old entitlement that was granted.

 

Request 1 that grants the initial enitlement

 const resp = await fetch(
        `https://api.revenuecat.com/v1/subscribers/${userId}/entitlements/premium/promotional`,
        {
            method: 'POST',
            headers: {
                Authorization: `Bearer ${REVENUECAT_API_KEY}`,
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({
                end_time_ms: Date.now() + 1000 * 60 * 60 * 24,
            }),
        }
  );

Returns 

{
  "entitlements":
    {"premium":
      {
        "expires_date":"2025-02-01T04:57:50Z",
        "grace_period_expires_date":null,
        "product_identifier":"rc_promo_premium_custom",
        "purchase_date":"2025-02-01T04:47:51Z"
      }
    }
}

After expiration, if we repeat the same request, I would expect a NEW entitlement with a new expiration to be created and activated. However, the same response comes back.

 

We would love to get this resolved, if possible! Thanks!

Best answer by Ryan Glanz

We discussed this in a support ticket, but for others looking at this:

The example request is a granted entitlement with a 24-h expiration (all good)

The example response was from a test using a 10-s expiration. Our API has limitations for short-term granted entitlements like this (i.e., if you try to grant an entitlement with an expiration within a couple hours of an existing granted entitlement’s expiration, it won’t be granted, and the API will respond with the previous granted entitlement’s info). For real-world applications of granted entitlements (i.e., more than a couple hours), this won’t be a problem.

View original
Did this post help you find an answer to your question?
This post has been closed for comments

1 reply

Ryan Glanz
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 383 replies
  • Answer
  • February 5, 2025

We discussed this in a support ticket, but for others looking at this:

The example request is a granted entitlement with a 24-h expiration (all good)

The example response was from a test using a 10-s expiration. Our API has limitations for short-term granted entitlements like this (i.e., if you try to grant an entitlement with an expiration within a couple hours of an existing granted entitlement’s expiration, it won’t be granted, and the API will respond with the previous granted entitlement’s info). For real-world applications of granted entitlements (i.e., more than a couple hours), this won’t be a problem.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings