Following recent changes in version 2.1, Auto PHP Licenser 2.2 brings new API for even more powerful automation.
More and more authors discover the power of PHP license manager API and integrate it to their billing systems to automatically create client profiles, issue new license keys, terminate licenses for cancelled orders, and more. In order to meet even most advanced developers’ needs, Auto PHP Licenser 2.2 comes with brand new API and offers even more automation options.
But here’s even better news: all scripts developed for older versions are fully compatible with new API and don’t require any modifications in code. That is to say, existing applications will continue executing API-based requests as usually. The biggest change in v2.2 is response body. From now on, PHP license script API returns additional fields with even more details, enabling webmasters to customize their systems like never before. For example, if author uses new API to issue a new license, he will receive such response in v2.2:
Array ( [api_action_success] => 1 [api_error_detected] => 0 [action_success] => 1 [error_detected] => 0 [page_message] => My-Product-Name license for some-license-code added to the database. )
Attention: API response is json-encoded by default, we decoded data in this example for easier reading.
As can be seen, response body now contains two types of status/error fields: API itself and original user request. Let’s take a closer look at each of them.
The first one (starting with api_) indicates status/error of API system itself. For example, if API is disabled, api_action_success will have a value of 0 and api_error_detected will have a value of 1. In addition, page_message will say: The action could not be completed because of this error: API not enabled or invalid API function.
If API is enabled and works properly, but original user request failed (for example, user tried to add a new license without specifying product), api_action_success will have a value of 1 and api_error_detected will have a value of 0 (because there’s nothing wrong with API itself), but action_success will have a value of 0 and error_detected will have a value of 1. Sure enough, page_message will say: Invalid product.
Finally, if both (API and user) requests succeeded, developer will receive a message like in the example above. Simple, isn’t it?
Important PHP license system upgrade notes.
For your convenience, new API uses the same authentication method, the same function names and arguments, so you don’t need to modify old code. It will work out of the box. However, response body is different now; therefore, all authors who output raw API messages directly in their applications, should take an extra minute and update code accordingly.
Needless to say, we updated PHP license manager documentation to cover new API, so you shouldn’t experience any issues during migration. But if you do, friendly support team at phpmillion support forums is ready to help you!
Attention: this is only needed for authors who use remote API in their scripts! Licensing module works without API by default; therefore, you do not need to update anything if you didn’t add custom requests to PHP license systemAPI in your script!
PHP License Manager Demo Script
Even more good news for you! We just uploaded a brand new Demo Script – a real-life application, which we created for you to show how easy you can to integrate Auto PHP Licenser into any PHP-based script. Run, test and enjoy it!