Is it possible to get information on the package through APEX after it has been installed? Specifically I want to know the Status (see below)
The reason I want this is because I want to show instructions how to purchase if the status is 'Trial'.
Unfortunately there is no way of obtaining this information from Apex. You do of course know this by running a report from within your LMO, so the info does exist, just not accessible in the subcriber org.
Unfortunately any callouts you make to your production org to obtain this information will also fail once the managed package is expired. The only thought I had was to perhaps send them an email via the UninstallHandler, assuming of course they bother to uninstall the package.
This really is quite a good observation though, "how can i notify my prospective customers that the software is about to expire?". Seems like a reasonable requirement to me, something that ought to be on IdeasExchange. If have no look and feel like raising one, I'll vote for it for you!
Kris, You can query all the installed packages on your org using following SOQL,
SELECT CreatedDate,ExpirationDate,Id,Status FROM PackageLicense WHERE NamespacePrefix = 'XXX'.
The PackageLicense object became available in api version 31.0.
Kris, I think you'll find the answer to your question in this message here on Stack Exchange.
You can use a call to
UserInfo.isCurrentUserLicensed('your_package_name') to check and see if the license for it has expired.