-
Notifications
You must be signed in to change notification settings - Fork 124
/
xero-app-store.yaml
539 lines (539 loc) · 18.4 KB
/
xero-app-store.yaml
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
openapi: 3.0.0
info:
version: 6.3.0
title: Xero AppStore API
description: These endpoints are for Xero Partners to interact with the App Store Billing platform
termsOfService: https://developer.xero.com/xero-developer-platform-terms-conditions/
contact:
name: Xero Platform Team
email: [email protected]
url: https://developer.xero.com
license:
name: MIT
url: https://github.com/XeroAPI/Xero-OpenAPI/blob/master/LICENSE
servers:
- description: Xero App Store API
url: https://api.xero.com/appstore/2.0
paths:
/subscriptions/{subscriptionId}:
get:
tags:
- AppStore
operationId: getSubscription
summary: Retrieves a subscription for a given subscriptionId
parameters:
- $ref: '#/components/parameters/subscriptionId'
responses:
"200":
description: Success - return response of unique Subscription object
content:
application/json:
schema:
$ref: '#/components/schemas/Subscription'
example:
currentPeriodEnd: 2021-07-20T03:13:48
endDate: 2021-07-20T03:13:48
id: 01b5a6f4-8936-4bfa-b703-830702312b87
testMode: true
organisationId: fdc5be44-9b3e-4ebb-a0e9-11b9737f9a28
plans:
- id: f617dd59-462f-46a1-9519-1765fd38b160
name: Small
status: ACTIVE
subscriptionItems:
- endDate: 2021-07-20T03:13:48
id: c7336bf6-8a47-4f13-9fc0-82420e6922c8
testMode: true
price:
amount: 50
currency: AUD
id: 31acefbe-bdb7-4329-84d6-51e9afd95327
product:
id: 56d66073-ff78-497b-a726-ca9d56fdafa3
name: Small
type: FIXED
quantity: 1
startDate: 2021-07-20T03:13:48
- endDate: 2021-07-20T03:13:48
id: 1a25bc96-141a-4e42-a0fa-55ed51844da4
testMode: true
price:
amount: 0.20
currency: AUD
id: 15c65048-1b48-4d9f-81c0-4e1cd3a4f49c
product:
id: e8d8ac02-01b3-47f7-8a22-99cfe9035cf7
name: Texts
type: METERED
usageUnit: txt
startDate: 2021-07-20T03:13:48
status: ACTIVE
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
description: When a failure occurs in the endpoint
security:
- OAuth2:
- marketplace.billing
/subscriptions/{subscriptionId}/items/{subscriptionItemId}/usage-records:
post:
tags:
- AppStore
operationId: postUsageRecords
summary: Send metered usage belonging to this subscription and subscription item
parameters:
- $ref: '#/components/parameters/idempotencyKey'
- $ref: '#/components/parameters/subscriptionId'
- $ref: '#/components/parameters/subscriptionItemId'
responses:
"200":
description: Success - return response of the record submitted
content:
application/json:
schema:
$ref: '#/components/schemas/UsageRecord'
example:
usageRecordId: 2a90f7d9-4c10-4a23-9c34-b47225167a48
subscriptionId: 391be708-878a-4741-acfb-c0bc9a165bdb
subscriptionItemId: b22b150f-a0db-447d-9117-d922110add64
productId: d2b133d9-95d8-4446-807a-ae7ebc7353f6
pricePerUnit: 0.10
quantity: 22
testMode: true
recordedAt: 2022-09-13T02:11:22
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
description: When a failure occurs in the endpoint
security:
- OAuth2:
- marketplace.billing
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUsageRecord'
example:
timestamp: 2022-01-21T13:01:00
quantity: 10
description: Contains the quantity for the usage record to create
required: true
/subscriptions/{subscriptionId}/items/{subscriptionItemId}/usage-records/{usageRecordId}:
put:
tags:
- AppStore
operationId: putUsageRecords
summary: Update and existing metered usage belonging to this subscription and subscription item
parameters:
- $ref: '#/components/parameters/idempotencyKey'
- $ref: '#/components/parameters/subscriptionId'
- $ref: '#/components/parameters/subscriptionItemId'
- $ref: '#/components/parameters/usageRecordId'
responses:
"200":
description: Success - return response of the modified record
content:
application/json:
schema:
$ref: '#/components/schemas/UsageRecord'
example:
usageRecordId: 2a90f7d9-4c10-4a23-9c34-b47225167a48
subscriptionId: 391be708-878a-4741-acfb-c0bc9a165bdb
subscriptionItemId: b22b150f-a0db-447d-9117-d922110add64
productId: d2b133d9-95d8-4446-807a-ae7ebc7353f6
pricePerUnit: 0.10
quantity: 22
testMode: true
recordedAt: 2022-09-13T02:11:22
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
description: When a failure occurs in the endpoint
security:
- OAuth2:
- marketplace.billing
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateUsageRecord'
example:
quantity: 10
description: Contains the quantity for the usage record to update
required: true
/subscriptions/{subscriptionId}/usage-records:
get:
tags:
- AppStore
operationId: getUsageRecords
summary: Gets all usage records related to the subscription
parameters:
- $ref: '#/components/parameters/subscriptionId'
responses:
"200":
description: Success - return a list of all usage record submitted against this subscription for this subscription period
content:
application/json:
schema:
$ref: '#/components/schemas/UsageRecordsList'
example:
usageRecords:
- usageRecordId: 206100d3-e18b-4c59-9372-e98e4367a73f
subscriptionId: 7c7684cf-bbfa-4fa8-8f44-eba8d1acdc5d
subscriptionItemId: 264f6fa2-65e6-48f4-8a92-57cde5499742
productId: b040838b-f85e-4e7c-8dba-5a8501e5d312
pricePerUnit: 2.0
quantity: 12
testMode: false
recordedAt: 2022-01-01T00:00:00
- usageRecordId: 47d61dc9-3c99-4587-8d55-0985f47df4a6
subscriptionId: 7c7684cf-bbfa-4fa8-8f44-eba8d1acdc5d
subscriptionItemId: 264f6fa2-65e6-48f4-8a92-57cde5499742
productId: ec8033e8-5e3c-4795-bfb4-bfb85fa4557e
pricePerUnit: 5.0
quantity: 2
testMode: false
recordedAt: 2022-01-01T00:00:00
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
description: When a failure occurs in the endpoint
security:
- OAuth2:
- marketplace.billing
components:
securitySchemes:
OAuth2:
type: oauth2
description: For more information
flows:
clientCredentials:
tokenUrl: https://identity.xero.com/connect/token
scopes:
marketplace.billing: Grant read-only access to fixed assets
parameters:
subscriptionId:
required: true
in: path
name: subscriptionId
x-snake: subscription_id
description: Unique identifier for Subscription object
example: 00000000-0000-0000-0000-000000000000
x-example-java: UUID.fromString("00000000-0000-0000-0000-000000000000")
x-example-php: '"00000000-0000-0000-0000-000000000000"'
x-example-csharp: Guid.Parse("00000000-0000-0000-0000-000000000000");
schema:
type: string
format: uuid
subscriptionItemId:
required: true
in: path
name: subscriptionItemId
x-snake: subscription_item_id
description: The unique identifier of the subscriptionItem
example: 00000000-0000-0000-0000-000000000000
x-example-java: UUID.fromString("00000000-0000-0000-0000-000000000000")
x-example-php: '"00000000-0000-0000-0000-000000000000"'
x-example-csharp: Guid.Parse("00000000-0000-0000-0000-000000000000");
schema:
type: string
format: uuid
usageRecordId:
required: true
in: path
name: usageRecordId
x-snake: usage_record_id
description: The unique identifier of the usage record
example: 00000000-0000-0000-0000-000000000000
x-example-java: UUID.fromString("00000000-0000-0000-0000-000000000000")
x-example-php: '"00000000-0000-0000-0000-000000000000"'
x-example-csharp: Guid.Parse("00000000-0000-0000-0000-000000000000");
schema:
type: string
format: uuid
idempotencyKey:
in: header
name: Idempotency-Key
x-snake: idempotency_key
description: This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
example: KEY_VALUE
schema:
type: string
schemas:
Subscription:
type: object
properties:
currentPeriodEnd:
description: |
End of the current period that the subscription has been invoiced for.
format: date-time
type: string
x-is-datetime: true
endDate:
description: If the subscription has been canceled, this is the date when the subscription ends. If null, the subscription is active and has not been cancelled
format: date-time
type: string
x-is-datetime: true
id:
description: The unique identifier of the subscription
format: uuid
type: string
organisationId:
description: The Xero generated unique identifier for the organisation
format: uuid
type: string
plans:
description: List of plans for the subscription.
type: array
items:
$ref: '#/components/schemas/Plan'
startDate:
description: Date when the subscription was first created.
format: date-time
type: string
x-is-datetime: true
status:
description: Status of the subscription. Available statuses are ACTIVE, CANCELED, and PAST_DUE.
type: string
enum:
- ACTIVE
- CANCELED
- PAST_DUE
testMode:
description: Boolean used to indicate if the subscription is in test mode
type: boolean
required:
- id
- organisationId
- status
- startDate
- currentPeriodEnd
- plans
Plan:
type: object
properties:
id:
description: The unique identifier of the plan
format: uuid
type: string
name:
description: |
The name of the plan. It is used in the invoice line item
description.
type: string
status:
description: |
Status of the plan. Available statuses are ACTIVE, CANCELED, and
PENDING_ACTIVATION.
type: string
enum:
- ACTIVE
- CANCELED
- PENDING_ACTIVATION
subscriptionItems:
description: |
List of the subscription items belonging to the plan. It does not
include cancelled subscription items.
items:
$ref: '#/components/schemas/SubscriptionItem'
type: array
required:
- id
- name
- status
- subscriptionItems
Price:
type: object
properties:
amount:
description: The net (before tax) amount.
type: number
format: double
x-is-money: true
currency:
description: The currency of the price.
type: string
id:
description: The unique identifier of the price.
format: uuid
type: string
required:
- id
- amount
- currency
ProblemDetails:
type: object
properties:
detail:
type: string
extensions:
type: object
instance:
type: string
status:
type: integer
title:
type: string
type:
type: string
SubscriptionItem:
type: object
properties:
endDate:
description: Date when the subscription to this product will end
format: date-time
type: string
x-is-datetime: true
id:
description: The unique identifier of the subscription item.
format: uuid
type: string
price:
description: The price of the product subscribed to.
$ref: '#/components/schemas/Price'
product:
description: The product subscribed to.
$ref: '#/components/schemas/Product'
quantity:
description: The quantity of the item. For a fixed product, it is 1. For a per-seat product, it is a positive integer. For metered products, it is always null.
type: integer
startDate:
description: |
Date the subscription started, or will start. Note: this could be in
the future for downgrades or reduced number of seats that haven't taken effect yet.
format: date-time
type: string
x-is-datetime: true
status:
description: |
Status of the subscription item. Available statuses are ACTIVE, CANCELED, and
PENDING_ACTIVATION.
type: string
enum:
- ACTIVE
- CANCELED
- PENDING_ACTIVATION
testMode:
description: If the subscription is a test subscription
type: boolean
required:
- id
- startDate
- product
- price
- status
Product:
properties:
id:
description: The unique identifier for the product
type: string
format: uuid
name:
description: The name of the product
type: string
seatUnit:
description: The unit of the per seat product. e.g. "user", "organisation", "SMS", etc
type: string
type:
description: |
The pricing model of the product:
* FIXED: Customers are charged a fixed amount for each billing period
* PER_SEAT: Customers are charged based on the number of units they purchase
* METERED: Customers are charged per use of this product
type: string
enum:
- FIXED
- PER_SEAT
- METERED
usageUnit:
description: The unit of the usage product. e.g. "user", "minutes", "SMS", etc
type: string
UsageRecord:
properties:
quantity:
description: The quantity recorded
format: int32
type: integer
subscriptionId:
description: The unique identifier of the Subscription.
format: guid
type: string
subscriptionItemId:
description: The unique identifier of the SubscriptionItem.
format: guid
type: string
testMode:
description: If the subscription is a test subscription
type: boolean
recordedAt:
description: The time when this usage was recorded in UTC
format: date-time
type: string
x-is-datetime: true
usageRecordId:
description: The unique identifier of the usageRecord.
format: guid
type: string
pricePerUnit:
description: The price per unit
format: decimal
type: number
productId:
description: The unique identifier of the linked Product
format: guid
type: string
required:
- usageRecordId
- subscriptionId
- subscriptionItemId
- productId
- pricePerUnit
- quantity
- testMode
- recordedAt
type: object
UsageRecordsList:
description: Response to get usage record
properties:
usageRecords:
description: A collection of usage records
items:
$ref: '#/components/schemas/UsageRecord'
type: array
required:
- usageRecords
type: object
CreateUsageRecord:
description: Data transfer object for public create usage end point
properties:
quantity:
description: The initial quantity for the usage record. Must be a whole number that is greater than or equal to 0
format: int32
type: integer
timestamp:
description: DateTime in UTC of when the the product was consumed/used
format: date-time
type: string
x-is-datetime: true
required:
- quantity
- timestamp
type: object
UpdateUsageRecord:
description: Data transfer object for public update usage end point
properties:
quantity:
description: The new quantity for the usage record. Must be a whole number that is greater than or equal to 0
format: int32
type: integer
required:
- quantity
type: object