programmatically determine if user has a current subscription

Discussion in 'Integration' started by zgwstores, Apr 20, 2015.

  1. zgwstores

    zgwstores New Member

    Joined:
    Apr 18, 2015
    Messages:
    6
    Hi

    Our web site is setup in such away that we need to determine a user's current subscription status (whether they paid) so that we can display certain pages and features to them. We don't want to use the protected folder/file system that aMember supports because of the complexity of the pages/features (like disabling certain buttons depending on the user's subscription status).

    Therefore, we would like to programmatically determine if a user has a current subscription. We know that there is a database table am_user that list the user along with dozens of associated fields that we can read via PHP. However, which of these fields determine if the user is in good standing (has paid)?

    We suspect it may be one, or a combination of, the following am_user fields:

    status, unsubscribed, is_approved ,is_locked

    Thanks for any help
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
  3. zgwstores

    zgwstores New Member

    Joined:
    Apr 18, 2015
    Messages:
    6
    Thanks, but the API won't work for all cases. In some instances the user is purchasing our software. But we allow them to use it free for 90 days. After the 90 days our software (which is installed on the user's system) will automatically communicate back to our servers that the users 90 day period has ended and check if they purchased a license from us. If they have, it will be recorded in the aMember system. If they have not, it won't be.

    Therefore we need to know which aMember MySQL table indicates that a user license is valid.

    I guess we could embed the aMember API in our software that we distribute, and use that to communicate back to our servers, but we would prefer to just use a simply php call to our database.

    Thanks.
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Sorry I'm not sure if I understood you right, do you want to allow direct MySQL access from your software which is installed on client's server to your MySQL database? I don't think that this is good idea.
    As I have understood you need to open some protected parts in your software which is installed on client's server is this right?
    If so you should use REST API : http://www.amember.com/docs/REST
    And I recommend to create own rest controller which will give only info which is necessary to check should client have access or not.
    So from your script you make a call to your rest controller and rest controller should return current access level for client.
  5. zgwstores

    zgwstores New Member

    Joined:
    Apr 18, 2015
    Messages:
    6
    The REST API works beautifully.

    Thanks !

Share This Page