Skip to main content
When a customer logs into your site and tries to access a resource, examine the (cached) Account’s Entitlements and their expiration dates, to determine whether to allow the customer entry. Do not retrieve the AutoBill object for the Account and examine its status, as Entitlements may remain active after an AutoBill has been stopped. For example, if a subscription is cancelled midway through a Billing Period, the AutoBill status will be Stopped, but the customer may be granted access until the paid period expires. The Entitlement object provides two methods for retrieving entitlements by the Account object, entitlementID, or both:
  • $entitlement->fetchByEntitlementIdAndAccount()
  • $entitlement->fetchByAccount()
Call these methods to determine if a customer can access a specific resource on your site. Both methods return Entitlement objects, each specifying an Account object, an entitlementID, and an endTimestamp value. To show if the Entitlement object is active on the date fetched, Subscribe sets the value of the active flag on the Entitlement objects returned by the calls according to the status of the associated AutoBill object and its end-date (the time until which the customer is expected to pay). Parent topic:Working with Entitlements