Fix receipt description
[ouya-store-api.git] / api / devs.ouya.tv / api-v1-games-xxx-purchases.rst
1 =======================================================
2 ``GET https://devs.ouya.tv/api/v1/games/xxx/purchases``
3 =======================================================
4
5 Check which features have been bought in an app (if the app has been
6 bought).
7
8 Each game may have multiple products that can be bought.
9 One of them may be the "promotedProduct" in the discover section, and
10 that one can be bought in the discover store / play menu app details.
11
12
13 Usage
14 =====
15 - When an app/game is featured and shown on the main menu ("home"),
16   it is checked if the app has already been purchased.
17 - When opening the game details the "buy" button is shown if the
18   "promotedProduct" is in the list of purchases
19 - When a game starts it checks if it has been bought.
20
21
22 HTTP request
23 ============
24 Protocol
25   ``https``
26 Method
27   ``GET``
28 Host
29   ``devs.ouya.tv``
30 Path
31   ``/api/v1/games/xxx/purchases``
32
33   ``xxx``
34     app package name
35
36   Example: ``/api/v1/games/com.ChrisChung.CatlateralDamage/purchases``
37 Headers
38   Standard headers
39 GET parameters
40   ``auth_token``
41     Same as ``X-OUYA-AuthToken``
42   ``app_id``
43     ``com.ChrisChung.CatlateralDamage``
44
45     Same as the one in the path.
46   ``user_agent``
47     ``launcher``
48
49
50 HTTP response
51 =============
52 Status code
53   ``200 OK``
54 Content-type
55   ``application/json; charset=utf-8``
56
57 The response is a JSON objec containing three properties:
58
59 ``iv``
60   Base 64 encoded initialization vector for encryption
61 ``key``
62   Base 64 encoded FIXME. Must be 128/192/256 bits long.
63 ``blob``
64   Base64 encoded encrypted data
65
66 The decrypted ``blob`` contains again a JSON object with three properties:
67
68 - ``iv``
69 - ``key``
70 - ``blob``
71
72 This blob is again base64-encoded JSON and contains the actual data:
73 A JSON with a single property "purchases" whose value is
74 an array of receipts/purchases.
75
76 Each receipt has the following properties:
77
78 ``purchaseDate``
79   Required. Milliseconds.
80 ``generateDate``
81   Optional. Milliseconds.
82 ``identifier``
83   Product key. Required. Alternative name: ``sku``.
84 ``gamer``
85   User UUID. Required.
86 ``uuid``
87   Transaction UUID. Required.
88 ``priceInCents``
89   Integer. Optional.
90 ``localPrice``
91   Float. Optional.
92 ``currency``
93   Optional. Default ``USD``.
94
95 Example
96 -------
97
98 Encrypted response:
99
100 .. include:: api-v1-games-xxx-purchases.response.json
101    :code:
102
103 Decrypted receipt list:
104
105 .. include:: api-v1-games-xxx-purchases.response-decrypted.json
106    :code: