Membership Pro has a very basic API methods to allow external applications (could be mobile app) to call to add, update, get details information of a subscription record.
If you want to use APIs, you will first need to enable it. Go to Membership Pro -> Configuration, look at API Settings tab, set Enable API parameter to Yes. You should also set a secret key into Api Key config option for secure purpose (only applications know that key can called the API methods)
Request URL: https://domain.com/index.php?option=com_osmembership&task=api.add&api_key=[API_KEY]
Request Data: Passed in key value-pair. Important parameter including:
Request URL: https://domain.com/index.php?option=com_osmembership&task=api.update&api_key=[API_KEY]
Request Data: Same with Add New Subscription. The only difference is is that you need to pass extra variable:
Request URL: https://domain.com/index.php?option=com_osmembership&task=api.get&api_key=[API_KEY]
Request Data:
Response: Json data contains all information of the subscription
Request URL: https://domain.com/index.php?option=com_osmembership&task=api.get_active_plan_ids&api_key=[API_KEY]
Request Data:
Please note that you should only pass user_id or username. If both are passed (which should not), user_id will take higher priority.
Request URL: https://domain.com/index.php?option=com_osmembership&task=api.get_user_active_subscriptions&api_key=[API_KEY]
Request Data:
Please note that you should only pass user_id or username. If both are passed (which should not), user_id will take higher priority.
Request Data:
Please note that you should only pass user_id or username. If both are passed (which should not), user_id will take higher priority.
Response: JSON data contains all the active subscriptions of the requested user
As you can see, the API here is very basic and limited. So if you want to connect to Membership Pro from external apps, it's very likely you would have to add your own API methods. To do that, you should implement these new api methods using override for api controller and api model
class OSMembershipControllerOverrideApi extends OSMembershipControllerApi
{
public function your_api_method()
{
}
}
```php
class OSMembershipModelOverrideApi extends OSMembershipModelApi
{
public function yourApiMethod()
{
}
}
See [https://membershipprodoc.joomservices.com/developer-documentation/code-customization-override#override-method-in-a-controller-class](https://membershipprodoc.joomservices.com/developer-documentation/code-customization-override#override-method-in-a-controller-class) and [https://membershipprodoc.joomservices.com/developer-documentation/code-customization-override#override-method-in-a-model-class](https://membershipprodoc.joomservices.com/developer-documentation/code-customization-override#override-method-in-a-model-class) to understand how to create override for controller and model