Introduction
This article explains how to use the Raw App Metrics End Point to acquire information about app usage.
NOTE: The Users Purchases is accessible only to accounts that have either the Seller Package, or eCommerce Package. Enterprise nor Trial accounts do not have access to this API.
App47 APIv2 User Purchases Overview
This API end point allows you to retrieve the purchases made by the identified customer.
If you don't know the User's ID, then use the Users search end point to find the information for the given user.
To use this API you must have the following permissions:
Action | Required permission |
---|---|
List purchases | At least read permission on user or have “Purchase Permission” set to true |
Show purchase | At least read permission on user or have “Purchase Permission” set to true |
For more information on how to configure your APIv2 calls, please consult the APIv2 Overview.
Parameters
When fetching, creating or updating information about users, the parameters in the following table are provided by our API:
Parameter Name | Input | Output | Description |
---|---|---|---|
uuid | No | Yes | Unique identifier from the subscription management system |
reference | No | Yes | Unique identifier from the transaction processing system (payment gateway) |
status | No | Yes | Status of purchase, either New, Purchased, Canceled, Refunded, Consumed |
price | No | Yes | The price of the item at the time of purchase |
currency | No | Yes | The currency used when purchasing the item |
List Purchases
In order to list user purchases in your account you have at least read access on user or purchase permissions set to true.
End Point
GET https://cirrus.app47.com/api/v2/users/«user_id»/purchases
Example:
curl -H"Access-Token: <<your token>>" https://cirrus.app47.com/api/v2/users/<<user_id>>/purchases
Input Parameters
Parameter | Description | Required? | Example(s)/Allowed Values |
---|---|---|---|
status | Status of the purchase | No | New, Purchased, Cancelled, Refunded, consumed |
skip | The number of records to skip over | No | Integer greater than zero |
Example, to list only purchases that are cancelled:
curl -H"Access-Token: <<your token>>" https://webui.app47.net/api/v2/users<<user_id>>/purchases?status=cancelled
Expected Output
If valid, it will return a result with:
-
Success set to true
-
Skip - The number of records that were skipped (The API will return sets of 100 records)
-
Total - The total number of records in your account
-
Count - The total number of records returned in this response
-
List - List of users you have access to and match the input parameters
-
A md5 hash of the results element
-
HTTP result code 200
{ "results": { "skip": 0, "total": 0, "count": 0, "list": [], "success":true }, "md5":"896d94e5e2f4eb6b6bfa19144c7794e5" }
If invalid, it will return a result with:
-
Success set to false
-
A message indicating the error
-
A md5 has of the results element
-
HTTP result code that is *not* 200
{ "results": { "message":"Access denied", "success":false }, "md5":"896d94e5e2f4eb6b6bfa19144c7794e5" }
Show a specific User purchase
Show a specific user's purchase in your account by User ID and purchase id.
End Point
GET https://cirrus.app47.com/api/v2/users/«user_id»/purchases/«purchase_id»
Example:
curl -H"Access-Token: <<your token>>" https://cirrus.app47.com/api/v2/users/<< user_id >>/purchases/<<purchase_id>>
Input Parameters
Parameter | Description | Required? | Example(s)/Allowed Values |
---|---|---|---|
user_id | The ID of the User | Yes | A valid user id in your account that you have permission to view |
purchase_id | The ID of the purchase | Yes | A valid purchase id in your account that you have permission to view |
Expected Output
{ "results": { "purchase": { "id":"544fa14538d6b81f6b00003d", "created":"2014-10-28T13:59:34Z", "modified":"2015-08-03T15:43:35Z", "uuid":"fj2k3r2jk32k2", "reference":"asd9fa9sdfa", "status":"Purchased", "name":"Application Name", "price":"1.99", "currency":"USD" }, "success":true }, "md5":"7232f70a2678e2b4ba959fd853488ab1" }
Comments
0 comments
Please sign in to leave a comment.