Repository navigation
Expand file tree
/
Copy pathmagesdkapidefinition.json
More file actions
594 lines (594 loc) · 29.5 KB
/
Copy pathmagesdkapidefinition.json
File metadata and controls
594 lines (594 loc) · 29.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
{
"openapi": "3.0.0",
"info": {
"title": "Mage SDK API Documentation",
"description": "[Mage](https://www.getmage.io/) is a price optimization tool for in-app purchases.<br> Forget continuously setting up A/B-Tests or hiring data science teams for your app pricing! Mage fully automates simultaneous price testing & setting for in-app purchases in over 170 countries separately. So you don't have to deal with it!<br> Get started with [Mage](https://www.getmage.io/) to scale your products worldwide!<br><br> This is a documentation of the Mage API used by the SDKs. In case you're interested in writing your own bridges feel free to do so or even better: publish your own open-source SDK.<br> The API is documented according to the [openapi3.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md) standard.",
"contact": {
"name": "Mage Labs GmbH i.G.",
"url": "https://www.getmage.io/"
},
"license": {
"name": "MIT"
},
"version": "1.1.0"
},
"servers": [
{
"url": "https://room-of-requirement.getmage.io/v1"
}
],
"paths": {
"/lumos": {
"post": {
"summary": "Analyze Purchase",
"description": "Submit the currently purchased IAP with the users' state. Every submited IAP will then be analyzed and used for future models to determine your optimal pricing.",
"operationId": "newPurchase",
"requestBody": {
"description": "Purchased iap & current State of User",
"content": {
"application/json": {
"schema": {
"required": [
"product",
"state"
],
"type": "object",
"properties": {
"product": {
"$ref": "#/components/schemas/product"
},
"state": {
"$ref": "#/components/schemas/state"
}
}
},
"examples": {
"purchase": {
"summary": "An example purchase send to lumos",
"value": {
"state": {
"time": 1593705685,
"appName": "AN EXAMPLE APP",
"bundleId": "com.example.example_app",
"deviceId": "unknown",
"isStrict": true,
"platform": "Google",
"timeZone": "GMT",
"storeCode": "US",
"appVersion": "1.0",
"deviceType": "Handset",
"isEmulator": true,
"systemName": "Android",
"buildNumber": 1,
"countryCode": "United States",
"deviceBrand": "Android",
"deviceModel": "Android SDK built for x86",
"currencyCode": "USD",
"isProduction": true,
"timeZoneCode": "GMT+00:00",
"systemVersion": "7.1.1"
},
"product": {
"id": 3,
"countryId": 236,
"productId": 1,
"trialTime": null,
"periodTime": null,
"productName": "normal",
"productType": "Non-Consumable",
"iapIdentifier": "com.example.example_app.premium_0_75",
"productGroupName": "Premium",
"periodTimeOfferLength": null,
"recommendationId": 4006
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "success/failure response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/response"
},
"examples": {
"200": {
"summary": "Everything worked out fine",
"value": {
"status": 200,
"message": "Light is bright"
}
}
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/response"
}
}
}
}
},
"security": [
{
"personal_access_token": []
}
]
}
},
"/accio": {
"post": {
"summary": "Get current best prices for that user",
"description": "Receive the latest optimal pricing packages for the users' current state.",
"operationId": "getIAPs",
"requestBody": {
"description": "Current State of User & last cached products",
"content": {
"application/json": {
"schema": {
"required": [
"state"
],
"type": "object",
"properties": {
"state": {
"$ref": "#/components/schemas/state"
},
"products": {
"type": "array",
"items": {
"$ref": "#/components/schemas/product"
}
}
}
},
"examples": {
"noProducts": {
"summary": "A request by a device which has no cached products (e.g. it is the first time starting the app).",
"value": {
"state": {
"deviceId": "unknown",
"systemName": "Android",
"time": 1593705685,
"isStrict": true,
"deviceType": "Handset",
"deviceBrand": "Android",
"isEmulator": true,
"appName": "AN EXAMPLE APP",
"bundleId": "com.example.example_app",
"timeZone": "GMT",
"platform": "Google",
"systemVersion": "7.1.1",
"isProduction": true,
"countryCode": "United States",
"appVersion": "1.0",
"storeCode": "US",
"currencyCode": "USD",
"timeZoneCode": "GMT+00:00",
"deviceModel": "Android SDK built for x86",
"buildNumber": 1
}
}
},
"allProductsInactive": {
"summary": "A request by a device which has cached products (e.g. app was running at least once).",
"value": {
"state": {
"deviceId": "unknown",
"systemName": "Android",
"time": 1593705685,
"isStrict": true,
"deviceType": "Handset",
"deviceBrand": "Android",
"isEmulator": true,
"appName": "AN EXAMPLE APP",
"bundleId": "com.example.example_app",
"timeZone": "GMT",
"platform": "Google",
"systemVersion": "7.1.1",
"isProduction": true,
"countryCode": "United States",
"appVersion": "1.0",
"storeCode": "US",
"currencyCode": "USD",
"timeZoneCode": "GMT+00:00",
"deviceModel": "Android SDK built for x86",
"buildNumber": 1
},
"products": [
{
"id": 5,
"iapIdentifier": "com.example.example_app.premium",
"productId": 1,
"productName": "com.example.example_app.premium",
"productType": "Non-Consumable",
"periodTime": null,
"trialTime": null,
"periodTimeOfferLength": null,
"productGroupName": "Premium",
"countryId": 236,
"recommendationId": 486
},
{
"id": 14,
"iapIdentifier": "com.example.example_app.premium_plus",
"productId": 2,
"productName": "com.example.example_app.premium_plus",
"productType": "Non-Consumable",
"periodTime": null,
"trialTime": null,
"periodTimeOfferLength": null,
"productGroupName": "Premium",
"countryId": 236,
"recommendationId": 986
}
]
}
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "In success: get the current best iaps",
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/productResponse"
},
{
"$ref": "#/components/schemas/response"
}
]
},
"examples": {
"200": {
"summary": "Receive currently best iaps.",
"value": {
"status": 200,
"message": "Sick",
"products": [
{
"id": 5,
"iapIdentifier": "com.example.example_app.premium",
"productId": 1,
"productName": "premium",
"productType": "Non-Consumable",
"periodTime": null,
"trialTime": null,
"periodTimeOfferLength": null,
"productGroupName": "Premium",
"countryId": 236,
"recommendationId": 4006
},
{
"id": 14,
"iapIdentifier": "com.example.example_app.premium_plus",
"productId": 2,
"productName": "premium_plus",
"productType": "Non-Consumable",
"periodTime": null,
"trialTime": null,
"periodTimeOfferLength": null,
"productGroupName": "Premium",
"countryId": 236,
"recommendationId": 4008
}
]
}
}
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/response"
}
}
}
}
},
"security": [
{
"personal_access_token": []
}
]
}
}
},
"components": {
"schemas": {
"productResponse": {
"allOf": [
{
"$ref": "#/components/schemas/response"
},
{
"required": [
"products"
],
"type": "object",
"properties": {
"products": {
"type": "array",
"items": {
"$ref": "#/components/schemas/product"
}
}
}
}
]
},
"response": {
"required": [
"status",
"message"
],
"type": "object",
"properties": {
"status": {
"type": "integer",
"format": "int64"
},
"message": {
"type": "string"
}
},
"example": {
"response": {
"status": 200,
"message": "Light is bright!"
}
}
},
"state": {
"required": [
"appName",
"appVersion",
"buildNumber",
"bundleId",
"countryCode",
"currencyCode",
"deviceBrand",
"deviceId",
"deviceModel",
"deviceType",
"isEmulator",
"isProduction",
"isStrict",
"platform",
"storeCode",
"systemName",
"systemVersion",
"time",
"timeZone",
"timeZoneCode"
],
"type": "object",
"description": "Information about the current users state.",
"properties": {
"appName": {
"description": "Your apps name.",
"type": "string"
},
"appUserId": {
"description": "Your user identifier for tracking the subscription status. This is important for subscriptions to track how long they run, if they convert from trial phases and so on. To notify Mage of subscription state changes please use the web API which can be found [here](#TODO).",
"type": "string"
},
"appVersion": {
"description": "Your current app version.",
"type": "string"
},
"buildNumber": {
"type": "integer",
"description": "Your current build number.",
"format": "int64"
},
"bundleId": {
"description": "The bundle-Id of your app (it doesn't matter whether it's iOS or Andoid).",
"type": "string"
},
"countryCode": {
"description": "The users current country location. Use the [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) standard! From iOS devices, you receive the alpha-2 code and from Android the alpha-3 code. So use depending on the device the standard accordingly.",
"type": "string"
},
"currencyCode": {
"description": "The currency code according to the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard.",
"type": "string"
},
"deviceBrand": {
"description": "Manufacturer of the device your app is running on (e.g. 'Apple', 'google', 'Nokia', etc.).",
"type": "string"
},
"deviceId": {
"description": "A more specific identifier of the device model your app is running on (e.g. 'iPhone10,6', 'iPhone8,4', etc.).",
"type": "string"
},
"deviceModel": {
"description": "The Model of the device your app is running on (e.g. 'iPhone X', 'iPhone 11 Pro', etc.).",
"type": "string"
},
"deviceType": {
"description": "Which kind of device your app is running on (e.g. 'Handset' or 'Tablet').",
"type": "string"
},
"isEmulator": {
"description": "Let's the system know, whether you're currently just implementing Mage and running it within an emulator. Always set TRUE when implementing and using an emulator so that Mage won't learn your test purchases! But don't forget to turn it of, when you are running it in production!",
"type": "boolean"
},
"isProduction": {
"description": "Let's the system know, whether you're currently just implementing Mage or if it is running live. Always set FALSE when implementing, so Mage won't learn your test purchases!",
"type": "boolean"
},
"isStrict": {
"description": "A flag to let the SDK crash when errors occur. This way, you can test if you set up the SDK correctly.",
"type": "boolean"
},
"platform": {
"description": "Whether we're in the Apple App Store (use 'Apple') or in the Google Play Store (use 'Google').",
"type": "string"
},
"storeCode": {
"description": "The users' current store location. Use the [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) standard! From iOS devices, you receive the alpha-3 code and from Android the alpha-2 code. So use depending on the device the standard accordingly.",
"type": "string"
},
"systemName": {
"description": "OS name (e.g. 'Android' or 'iOS').",
"type": "string"
},
"systemVersion": {
"description": "Current OS version, on which the app is running.",
"type": "string"
},
"time": {
"type": "integer",
"description": "Current time (unix-timestamp).",
"format": "int64"
},
"timeZone": {
"description": "Code of timezone.",
"type": "string"
},
"timeZoneCode": {
"description": "Code of timezone plus offset.",
"type": "string"
}
},
"example": {
"state": {
"time": 1593705685,
"appName": "AN EXAMPLE APP",
"bundleId": "com.example.example_app",
"deviceId": "unknown",
"isStrict": true,
"platform": "Google",
"timeZone": "GMT",
"storeCode": "US",
"appVersion": "1.0",
"deviceType": "Handset",
"isEmulator": true,
"systemName": "Android",
"buildNumber": 1,
"countryCode": "United States",
"deviceBrand": "Android",
"deviceModel": "Android SDK built for x86",
"currencyCode": "USD",
"isProduction": true,
"timeZoneCode": "GMT+00:00",
"systemVersion": "7.1.1"
}
}
},
"product": {
"required": [
"id",
"iapIdentifier",
"productId",
"productName",
"productType",
"periodTime",
"trialTime",
"periodTimeOfferLength",
"productGroupName",
"countryId",
"recommendationId"
],
"type": "object",
"description": "The Mage internal product for your different price levels.",
"properties": {
"id": {
"type": "integer",
"description": "Internal IAP Id",
"format": "int64"
},
"iapIdentifier": {
"type": "string",
"description": "Identifier, used by apple/google, for your in-app purchase."
},
"productId": {
"type": "integer",
"description": "Internal Product Id",
"format": "int64"
},
"productName": {
"type": "string",
"description": "Name of your product"
},
"productType": {
"type": "string",
"description": "Type of your product (Subscription, Consumable, Non-Consumable)"
},
"periodTime": {
"type": "number",
"description": "For subscriptions only. Billing cycles for your subscription.",
"format": "float"
},
"trialTime": {
"type": "number",
"description": "For subscriptions only. Duration of the trial time for your subscription.",
"format": "float"
},
"periodTimeOfferLength": {
"type": "number",
"description": "For subscriptions only. Duration of the reduced offer lenght.",
"format": "float"
},
"productGroupName": {
"type": "string",
"description": "Name of the productgroup your product belongs to."
},
"countryId": {
"type": "integer",
"description": "Id of the country, in which your IAP is currently served.",
"format": "int64"
},
"recommendationId": {
"type": "integer",
"description": "Id of the recommendation, which suggested this price.",
"format": "int64"
}
},
"example": {
"product": {
"id": 3,
"countryId": 236,
"productId": 1,
"trialTime": null,
"periodTime": null,
"productName": "normal",
"productType": "Non-Consumable",
"iapIdentifier": "com.example.example_app.premium_0_75",
"productGroupName": "Premium",
"periodTimeOfferLength": null,
"recommendationId": 4006
}
}
}
},
"securitySchemes": {
"personal_access_token": {
"type": "apiKey",
"description": "Personal App-API-Key to access the protected resources.",
"name": "Token",
"in": "header"
}
}
}
}