@@ -18,12 +18,16 @@ Then, create an instance of the client, giving it your provider API key:
1818
1919Because the object is stateless, you can create just one and store it globally.
2020
21+ ** NOTE: From November 2016 ` service_id ` is mandatory.**
22+
2123### Authorize
2224
2325To authorize a particular application, call the ` authorize ` method passing it the
2426application id and optionally the application key:
2527
2628 $response = $client->authorize("the app id", "the app key");
29+ or
30+ $response = $client->authorize("the app id", "the app key", "the service id");
2731
2832Then call the ` isSuccess() ` method on the returned object to see if the authorization was
2933successful:
@@ -34,14 +38,12 @@ successful:
3438 // Something's wrong with this app.
3539 }
3640
37- If both provider and app id are valid, the response object contains additional information
38- about the status of the application:
41+ If both provider and app id are valid, the response object contains additional information about the status of the application:
3942
4043 // Returns the name of the plan the application is signed up to.
4144 $response->getPlan()
4245
43- If the plan has defined usage limits, the response contains details about the usage broken
44- down by the metrics and usage limit periods.
46+ If the plan has defined usage limits, the response contains details about the usage broken down by the metrics and usage limit periods.
4547
4648 // The usageReports array contains one element per each usage limit defined on the plan.
4749 $usageReports = $response->getUsageReports();
@@ -64,8 +66,7 @@ down by the metrics and usage limit periods.
6466 // If the limit is exceeded, this will be true, otherwise false:
6567 $usageReport->isExceeded() // false
6668
67- If the authorization failed, the ` getErrorCode() ` returns system error code and
68- ` getErrorMessage() ` human readable error description:
69+ If the authorization failed, the ` getErrorCode() ` returns system error code and ` getErrorMessage() ` human readable error description:
6970
7071 $response->getErrorCode() // "usage_limits_exceeded"
7172 $response->getErrorMessage() // "Usage limits are exceeded"
@@ -76,7 +77,7 @@ To report usage, use the `report` method. You can report multiple transaction at
7677
7778 $response = $client->report(array(
7879 array('app_id' => "first app's id", 'usage' => array('hits' => 1)),
79- array('app_id' => "second app's id", 'usage' => array('hits' => 1))));
80+ array('app_id' => "second app's id", 'usage' => array('hits' => 1))), "service id" );
8081
8182The ` "app_id" ` and ` "usage" ` parameters are required. Additionaly, you can specify a timestamp
8283of the transaction:
0 commit comments