@fleetless/contracts 6.5.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/artifacts/openapi.json +5805 -1805
  3. package/artifacts/routes.json +75 -13
  4. package/artifacts/schema/addon-catalogue-entry.schema.json +1 -15
  5. package/artifacts/schema/billing-address.schema.json +7 -1
  6. package/artifacts/schema/billing-change-request.schema.json +9 -0
  7. package/artifacts/schema/billing-change-response.schema.json +2219 -625
  8. package/artifacts/schema/billing-details-update.schema.json +70 -0
  9. package/artifacts/schema/billing-details.schema.json +27 -3
  10. package/artifacts/schema/billing-view.schema.json +56 -24
  11. package/artifacts/schema/checkout-request.schema.json +90 -154
  12. package/artifacts/schema/checkout-response.schema.json +531 -17
  13. package/artifacts/schema/invoice-pay-request.schema.json +16 -0
  14. package/artifacts/schema/payment-method-change-request.schema.json +7 -0
  15. package/artifacts/schema/plan-catalogue-entry.schema.json +1 -15
  16. package/artifacts/schema/plan-prices.schema.json +1 -15
  17. package/artifacts/schema/purchase-billing-details.schema.json +111 -0
  18. package/artifacts/schema/purchase-conflict-details.schema.json +582 -0
  19. package/artifacts/schema/purchase-hold-reason.schema.json +9 -0
  20. package/artifacts/schema/purchase-intent-confirm-request.schema.json +40 -0
  21. package/artifacts/schema/purchase-intent-lookup-query.schema.json +56 -0
  22. package/artifacts/schema/purchase-intent-response.schema.json +1554 -0
  23. package/artifacts/schema/purchase-operation-key.schema.json +7 -0
  24. package/artifacts/schema/purchase-operation.schema.json +11 -0
  25. package/artifacts/schema/purchase-quote.schema.json +43 -0
  26. package/artifacts/schema/purchase-refusal-rule.schema.json +13 -0
  27. package/artifacts/schema/vat-decision.schema.json +77 -0
  28. package/artifacts/schema/vat-id-check-response.schema.json +111 -25
  29. package/artifacts/schema/vies-pending-reason.schema.json +9 -0
  30. package/dist/billing.d.ts +1128 -75
  31. package/dist/billing.js +174 -66
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +1 -0
  34. package/dist/plans.d.ts +4 -9
  35. package/dist/plans.js +4 -7
  36. package/dist/routes.js +33 -60
  37. package/package.json +1 -1
@@ -0,0 +1,1554 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "anyOf": [
4
+ {
5
+ "oneOf": [
6
+ {
7
+ "type": "object",
8
+ "properties": {
9
+ "intent_id": {
10
+ "type": "string",
11
+ "format": "uuid",
12
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
13
+ "description": "Opaque persisted purchase intent identity."
14
+ },
15
+ "operation_key": {
16
+ "type": "string",
17
+ "format": "uuid",
18
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
19
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
20
+ },
21
+ "operation": {
22
+ "type": "string",
23
+ "enum": [
24
+ "checkout",
25
+ "paid_change",
26
+ "invoice_payment",
27
+ "payment_method_invoice"
28
+ ]
29
+ },
30
+ "invoice_id": {
31
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
32
+ "type": "string",
33
+ "format": "uuid",
34
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
35
+ },
36
+ "state": {
37
+ "type": "string",
38
+ "const": "awaiting_vies"
39
+ },
40
+ "reason": {
41
+ "type": "string",
42
+ "enum": [
43
+ "vies_unavailable",
44
+ "vies_unverified",
45
+ "vies_identifier_missing"
46
+ ]
47
+ },
48
+ "next_attempt_at": {
49
+ "type": "string",
50
+ "format": "date-time",
51
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
52
+ }
53
+ },
54
+ "required": [
55
+ "intent_id",
56
+ "operation_key",
57
+ "operation",
58
+ "state",
59
+ "reason",
60
+ "next_attempt_at"
61
+ ],
62
+ "additionalProperties": false
63
+ },
64
+ {
65
+ "type": "object",
66
+ "properties": {
67
+ "intent_id": {
68
+ "type": "string",
69
+ "format": "uuid",
70
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
71
+ "description": "Opaque persisted purchase intent identity."
72
+ },
73
+ "operation_key": {
74
+ "type": "string",
75
+ "format": "uuid",
76
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
77
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
78
+ },
79
+ "operation": {
80
+ "type": "string",
81
+ "enum": [
82
+ "checkout",
83
+ "paid_change",
84
+ "invoice_payment",
85
+ "payment_method_invoice"
86
+ ]
87
+ },
88
+ "invoice_id": {
89
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
90
+ "type": "string",
91
+ "format": "uuid",
92
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
93
+ },
94
+ "quote_revision": {
95
+ "type": "string",
96
+ "minLength": 1,
97
+ "maxLength": 200,
98
+ "description": "Opaque revision of the displayed quote; echo it when confirming."
99
+ },
100
+ "buyer_fingerprint": {
101
+ "type": "string",
102
+ "minLength": 1,
103
+ "maxLength": 200,
104
+ "description": "Opaque revision of buyer details and email policy; never full VIES evidence."
105
+ },
106
+ "state": {
107
+ "type": "string",
108
+ "const": "eligible"
109
+ },
110
+ "quote": {
111
+ "type": "object",
112
+ "properties": {
113
+ "currency": {
114
+ "type": "string",
115
+ "const": "eur",
116
+ "description": "Every new quote is in EUR."
117
+ },
118
+ "net_cents": {
119
+ "type": "integer",
120
+ "minimum": 0,
121
+ "maximum": 9007199254740991,
122
+ "description": "Current charge excluding VAT, in cents."
123
+ },
124
+ "vat_cents": {
125
+ "type": "integer",
126
+ "minimum": 0,
127
+ "maximum": 9007199254740991,
128
+ "description": "VAT on the current charge, in cents."
129
+ },
130
+ "gross_cents": {
131
+ "type": "integer",
132
+ "minimum": 0,
133
+ "maximum": 9007199254740991,
134
+ "description": "Total to confirm, including VAT, in cents."
135
+ },
136
+ "rate_percent": {
137
+ "type": "integer",
138
+ "minimum": 0,
139
+ "maximum": 100,
140
+ "description": "VAT rate in whole percent."
141
+ }
142
+ },
143
+ "required": [
144
+ "currency",
145
+ "net_cents",
146
+ "vat_cents",
147
+ "gross_cents",
148
+ "rate_percent"
149
+ ],
150
+ "additionalProperties": false
151
+ }
152
+ },
153
+ "required": [
154
+ "intent_id",
155
+ "operation_key",
156
+ "operation",
157
+ "quote_revision",
158
+ "buyer_fingerprint",
159
+ "state",
160
+ "quote"
161
+ ],
162
+ "additionalProperties": false
163
+ },
164
+ {
165
+ "type": "object",
166
+ "properties": {
167
+ "intent_id": {
168
+ "type": "string",
169
+ "format": "uuid",
170
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
171
+ "description": "Opaque persisted purchase intent identity."
172
+ },
173
+ "operation_key": {
174
+ "type": "string",
175
+ "format": "uuid",
176
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
177
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
178
+ },
179
+ "operation": {
180
+ "type": "string",
181
+ "enum": [
182
+ "checkout",
183
+ "paid_change",
184
+ "invoice_payment",
185
+ "payment_method_invoice",
186
+ "mandate_setup"
187
+ ]
188
+ },
189
+ "invoice_id": {
190
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
191
+ "type": "string",
192
+ "format": "uuid",
193
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
194
+ },
195
+ "state": {
196
+ "type": "string",
197
+ "const": "held"
198
+ },
199
+ "reason": {
200
+ "type": "string",
201
+ "enum": [
202
+ "legacy_usd_invoice",
203
+ "legacy_payer_unresolved",
204
+ "mandate_policy_unresolved"
205
+ ]
206
+ },
207
+ "original_amount": {
208
+ "description": "Recorded balance of a held invoice; not a new quote or authorization.",
209
+ "type": "object",
210
+ "properties": {
211
+ "currency": {
212
+ "type": "string",
213
+ "enum": [
214
+ "eur",
215
+ "usd"
216
+ ]
217
+ },
218
+ "gross_cents": {
219
+ "type": "integer",
220
+ "minimum": 0,
221
+ "maximum": 9007199254740991
222
+ }
223
+ },
224
+ "required": [
225
+ "currency",
226
+ "gross_cents"
227
+ ],
228
+ "additionalProperties": false
229
+ }
230
+ },
231
+ "required": [
232
+ "intent_id",
233
+ "operation_key",
234
+ "operation",
235
+ "state",
236
+ "reason"
237
+ ],
238
+ "additionalProperties": false
239
+ },
240
+ {
241
+ "type": "object",
242
+ "properties": {
243
+ "intent_id": {
244
+ "type": "string",
245
+ "format": "uuid",
246
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
247
+ "description": "Opaque persisted purchase intent identity."
248
+ },
249
+ "operation_key": {
250
+ "type": "string",
251
+ "format": "uuid",
252
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
253
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
254
+ },
255
+ "operation": {
256
+ "type": "string",
257
+ "enum": [
258
+ "checkout",
259
+ "paid_change",
260
+ "invoice_payment",
261
+ "payment_method_invoice"
262
+ ]
263
+ },
264
+ "invoice_id": {
265
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
266
+ "type": "string",
267
+ "format": "uuid",
268
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
269
+ },
270
+ "state": {
271
+ "type": "string",
272
+ "const": "invalid_vat_id"
273
+ },
274
+ "field": {
275
+ "type": "string",
276
+ "const": "billing.vat_id"
277
+ },
278
+ "rule": {
279
+ "type": "string",
280
+ "const": "vat_id_invalid"
281
+ }
282
+ },
283
+ "required": [
284
+ "intent_id",
285
+ "operation_key",
286
+ "operation",
287
+ "state",
288
+ "field",
289
+ "rule"
290
+ ],
291
+ "additionalProperties": false
292
+ },
293
+ {
294
+ "type": "object",
295
+ "properties": {
296
+ "intent_id": {
297
+ "type": "string",
298
+ "format": "uuid",
299
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
300
+ "description": "Opaque persisted purchase intent identity."
301
+ },
302
+ "operation_key": {
303
+ "type": "string",
304
+ "format": "uuid",
305
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
306
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
307
+ },
308
+ "operation": {
309
+ "type": "string",
310
+ "enum": [
311
+ "checkout",
312
+ "paid_change",
313
+ "invoice_payment",
314
+ "payment_method_invoice"
315
+ ]
316
+ },
317
+ "invoice_id": {
318
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
319
+ "type": "string",
320
+ "format": "uuid",
321
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
322
+ },
323
+ "state": {
324
+ "type": "string",
325
+ "const": "refused"
326
+ },
327
+ "field": {
328
+ "type": "string",
329
+ "minLength": 1
330
+ },
331
+ "rule": {
332
+ "type": "string",
333
+ "enum": [
334
+ "company_required",
335
+ "vat_id_required",
336
+ "vat_id_invalid",
337
+ "tax_id_required",
338
+ "us_state_required",
339
+ "public_email_domain",
340
+ "invoice_not_open"
341
+ ]
342
+ }
343
+ },
344
+ "required": [
345
+ "intent_id",
346
+ "operation_key",
347
+ "operation",
348
+ "state",
349
+ "field",
350
+ "rule"
351
+ ],
352
+ "additionalProperties": false
353
+ },
354
+ {
355
+ "type": "object",
356
+ "properties": {
357
+ "intent_id": {
358
+ "type": "string",
359
+ "format": "uuid",
360
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
361
+ "description": "Opaque persisted purchase intent identity."
362
+ },
363
+ "operation_key": {
364
+ "type": "string",
365
+ "format": "uuid",
366
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
367
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
368
+ },
369
+ "operation": {
370
+ "type": "string",
371
+ "enum": [
372
+ "checkout",
373
+ "paid_change",
374
+ "invoice_payment",
375
+ "payment_method_invoice"
376
+ ]
377
+ },
378
+ "invoice_id": {
379
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
380
+ "type": "string",
381
+ "format": "uuid",
382
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
383
+ },
384
+ "state": {
385
+ "type": "string",
386
+ "const": "payment_started"
387
+ },
388
+ "payment_id": {
389
+ "type": "string",
390
+ "format": "uuid",
391
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
392
+ },
393
+ "payment": {
394
+ "oneOf": [
395
+ {
396
+ "type": "object",
397
+ "properties": {
398
+ "kind": {
399
+ "type": "string",
400
+ "const": "hosted"
401
+ },
402
+ "checkout_id": {
403
+ "type": "string",
404
+ "format": "uuid",
405
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
406
+ },
407
+ "checkout_url": {
408
+ "type": "string",
409
+ "format": "uri"
410
+ }
411
+ },
412
+ "required": [
413
+ "kind",
414
+ "checkout_id",
415
+ "checkout_url"
416
+ ],
417
+ "additionalProperties": false
418
+ },
419
+ {
420
+ "type": "object",
421
+ "properties": {
422
+ "kind": {
423
+ "type": "string",
424
+ "const": "mandate"
425
+ }
426
+ },
427
+ "required": [
428
+ "kind"
429
+ ],
430
+ "additionalProperties": false
431
+ }
432
+ ]
433
+ }
434
+ },
435
+ "required": [
436
+ "intent_id",
437
+ "operation_key",
438
+ "operation",
439
+ "state",
440
+ "payment_id",
441
+ "payment"
442
+ ],
443
+ "additionalProperties": false
444
+ }
445
+ ],
446
+ "allOf": [
447
+ {
448
+ "if": {
449
+ "properties": {
450
+ "operation": {
451
+ "enum": [
452
+ "invoice_payment",
453
+ "payment_method_invoice"
454
+ ]
455
+ }
456
+ },
457
+ "required": [
458
+ "operation"
459
+ ]
460
+ },
461
+ "then": {
462
+ "required": [
463
+ "invoice_id"
464
+ ]
465
+ }
466
+ },
467
+ {
468
+ "if": {
469
+ "properties": {
470
+ "operation": {
471
+ "const": "mandate_setup"
472
+ }
473
+ },
474
+ "required": [
475
+ "operation"
476
+ ]
477
+ },
478
+ "then": {
479
+ "properties": {
480
+ "state": {
481
+ "const": "held"
482
+ },
483
+ "reason": {
484
+ "const": "mandate_policy_unresolved"
485
+ }
486
+ },
487
+ "required": [
488
+ "reason"
489
+ ]
490
+ }
491
+ },
492
+ {
493
+ "if": {
494
+ "properties": {
495
+ "reason": {
496
+ "const": "mandate_policy_unresolved"
497
+ }
498
+ },
499
+ "required": [
500
+ "reason"
501
+ ]
502
+ },
503
+ "then": {
504
+ "properties": {
505
+ "operation": {
506
+ "const": "mandate_setup"
507
+ }
508
+ }
509
+ }
510
+ },
511
+ {
512
+ "if": {
513
+ "properties": {
514
+ "payment": {
515
+ "properties": {
516
+ "kind": {
517
+ "const": "mandate"
518
+ }
519
+ },
520
+ "required": [
521
+ "kind"
522
+ ]
523
+ }
524
+ },
525
+ "required": [
526
+ "payment"
527
+ ]
528
+ },
529
+ "then": {
530
+ "properties": {
531
+ "operation": {
532
+ "const": "paid_change"
533
+ }
534
+ }
535
+ }
536
+ }
537
+ ]
538
+ },
539
+ {
540
+ "type": "object",
541
+ "properties": {
542
+ "billing": {
543
+ "type": "object",
544
+ "properties": {
545
+ "available": {
546
+ "type": "boolean",
547
+ "description": "Whether this cloud takes payments at all — `false` when no Mollie key is configured."
548
+ },
549
+ "account": {
550
+ "anyOf": [
551
+ {
552
+ "type": "object",
553
+ "properties": {
554
+ "payer": {
555
+ "oneOf": [
556
+ {
557
+ "type": "object",
558
+ "properties": {
559
+ "kind": {
560
+ "type": "string",
561
+ "const": "company",
562
+ "description": "Billed as a company."
563
+ },
564
+ "company_name": {
565
+ "type": "string",
566
+ "minLength": 1,
567
+ "maxLength": 200,
568
+ "description": "The company's legal name, printed on the invoice."
569
+ },
570
+ "vat_id": {
571
+ "anyOf": [
572
+ {
573
+ "type": "string",
574
+ "maxLength": 20
575
+ },
576
+ {
577
+ "type": "null"
578
+ }
579
+ ],
580
+ "description": "The company's VAT ID, or `null` for none. Required for a new purchase in another EU country; direct VIES must confirm it with an identifier."
581
+ },
582
+ "tax_id": {
583
+ "description": "Free-text Tax ID. Required for a new non-EU purchase; historical records may omit it.",
584
+ "anyOf": [
585
+ {
586
+ "type": "string",
587
+ "maxLength": 100
588
+ },
589
+ {
590
+ "type": "null"
591
+ }
592
+ ]
593
+ },
594
+ "address": {
595
+ "type": "object",
596
+ "properties": {
597
+ "line1": {
598
+ "type": "string",
599
+ "minLength": 1,
600
+ "maxLength": 200,
601
+ "description": "Street and number, or the first address line."
602
+ },
603
+ "line2": {
604
+ "anyOf": [
605
+ {
606
+ "type": "string",
607
+ "maxLength": 200
608
+ },
609
+ {
610
+ "type": "null"
611
+ }
612
+ ],
613
+ "description": "A second address line, or `null` when there is none."
614
+ },
615
+ "postal_code": {
616
+ "type": "string",
617
+ "minLength": 1,
618
+ "maxLength": 20,
619
+ "description": "Postal or ZIP code."
620
+ },
621
+ "city": {
622
+ "type": "string",
623
+ "minLength": 1,
624
+ "maxLength": 100,
625
+ "description": "City or town."
626
+ },
627
+ "country": {
628
+ "type": "string",
629
+ "pattern": "^[A-Z]{2}$",
630
+ "description": "The billing country, used for purchase eligibility and VAT."
631
+ },
632
+ "state": {
633
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
634
+ "type": "string",
635
+ "minLength": 1,
636
+ "maxLength": 100
637
+ }
638
+ },
639
+ "required": [
640
+ "line1",
641
+ "line2",
642
+ "postal_code",
643
+ "city",
644
+ "country"
645
+ ],
646
+ "additionalProperties": false,
647
+ "description": "The billing address."
648
+ },
649
+ "invoice_email": {
650
+ "type": "string",
651
+ "format": "email",
652
+ "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
653
+ "description": "Where invoices and billing mail are sent."
654
+ }
655
+ },
656
+ "required": [
657
+ "kind",
658
+ "company_name",
659
+ "vat_id",
660
+ "address",
661
+ "invoice_email"
662
+ ],
663
+ "additionalProperties": false,
664
+ "description": "A company: name and an optional VAT ID, never 'full name'."
665
+ },
666
+ {
667
+ "type": "object",
668
+ "properties": {
669
+ "kind": {
670
+ "type": "string",
671
+ "const": "person",
672
+ "description": "Billed as a person."
673
+ },
674
+ "full_name": {
675
+ "type": "string",
676
+ "minLength": 1,
677
+ "maxLength": 200,
678
+ "description": "The person's full name, printed on the invoice."
679
+ },
680
+ "address": {
681
+ "type": "object",
682
+ "properties": {
683
+ "line1": {
684
+ "type": "string",
685
+ "minLength": 1,
686
+ "maxLength": 200,
687
+ "description": "Street and number, or the first address line."
688
+ },
689
+ "line2": {
690
+ "anyOf": [
691
+ {
692
+ "type": "string",
693
+ "maxLength": 200
694
+ },
695
+ {
696
+ "type": "null"
697
+ }
698
+ ],
699
+ "description": "A second address line, or `null` when there is none."
700
+ },
701
+ "postal_code": {
702
+ "type": "string",
703
+ "minLength": 1,
704
+ "maxLength": 20,
705
+ "description": "Postal or ZIP code."
706
+ },
707
+ "city": {
708
+ "type": "string",
709
+ "minLength": 1,
710
+ "maxLength": 100,
711
+ "description": "City or town."
712
+ },
713
+ "country": {
714
+ "type": "string",
715
+ "pattern": "^[A-Z]{2}$",
716
+ "description": "The billing country, used for purchase eligibility and VAT."
717
+ },
718
+ "state": {
719
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
720
+ "type": "string",
721
+ "minLength": 1,
722
+ "maxLength": 100
723
+ }
724
+ },
725
+ "required": [
726
+ "line1",
727
+ "line2",
728
+ "postal_code",
729
+ "city",
730
+ "country"
731
+ ],
732
+ "additionalProperties": false,
733
+ "description": "The billing address."
734
+ },
735
+ "invoice_email": {
736
+ "type": "string",
737
+ "format": "email",
738
+ "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
739
+ "description": "Where invoices and billing mail are sent."
740
+ }
741
+ },
742
+ "required": [
743
+ "kind",
744
+ "full_name",
745
+ "address",
746
+ "invoice_email"
747
+ ],
748
+ "additionalProperties": false,
749
+ "description": "A person: a full name, never a VAT ID — only a company can be VAT-registered."
750
+ }
751
+ ],
752
+ "description": "Who is paying, and the invoice address and email."
753
+ },
754
+ "vat_id_status": {
755
+ "anyOf": [
756
+ {
757
+ "type": "string",
758
+ "enum": [
759
+ "valid",
760
+ "unverified",
761
+ "invalid",
762
+ "unavailable"
763
+ ]
764
+ },
765
+ {
766
+ "type": "null"
767
+ }
768
+ ],
769
+ "description": "The payer's VAT ID check, or `null` when no VAT ID was given."
770
+ },
771
+ "vat": {
772
+ "anyOf": [
773
+ {
774
+ "type": "object",
775
+ "properties": {
776
+ "treatment": {
777
+ "type": "string",
778
+ "enum": [
779
+ "de_standard",
780
+ "reverse_charge",
781
+ "outside_eu"
782
+ ],
783
+ "description": "How the account is taxed."
784
+ },
785
+ "rate_percent": {
786
+ "type": "integer",
787
+ "minimum": -9007199254740991,
788
+ "maximum": 9007199254740991,
789
+ "description": "The VAT rate, in whole percent."
790
+ }
791
+ },
792
+ "required": [
793
+ "treatment",
794
+ "rate_percent"
795
+ ],
796
+ "additionalProperties": false
797
+ },
798
+ {
799
+ "type": "null"
800
+ }
801
+ ],
802
+ "description": "Recorded VAT treatment; null while the current buyer has no eligible decision. Never infer zero rating from a pending account."
803
+ },
804
+ "currency": {
805
+ "type": "string",
806
+ "enum": [
807
+ "eur",
808
+ "usd"
809
+ ],
810
+ "description": "The org's billing currency, fixed at the first payment."
811
+ },
812
+ "cycle": {
813
+ "type": "string",
814
+ "enum": [
815
+ "monthly",
816
+ "yearly"
817
+ ],
818
+ "description": "The current billing cycle."
819
+ },
820
+ "status": {
821
+ "type": "string",
822
+ "enum": [
823
+ "pending",
824
+ "active",
825
+ "past_due",
826
+ "canceled"
827
+ ],
828
+ "description": "The account's own status."
829
+ },
830
+ "period_starts_at": {
831
+ "anyOf": [
832
+ {
833
+ "type": "string",
834
+ "format": "date-time",
835
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
836
+ },
837
+ {
838
+ "type": "null"
839
+ }
840
+ ],
841
+ "description": "The current period's start. `null` before the first payment."
842
+ },
843
+ "period_ends_at": {
844
+ "anyOf": [
845
+ {
846
+ "type": "string",
847
+ "format": "date-time",
848
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
849
+ },
850
+ {
851
+ "type": "null"
852
+ }
853
+ ],
854
+ "description": "The current period's end. `null` before the first payment."
855
+ },
856
+ "next_charge": {
857
+ "anyOf": [
858
+ {
859
+ "type": "object",
860
+ "properties": {
861
+ "at": {
862
+ "type": "string",
863
+ "format": "date-time",
864
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
865
+ "description": "When the next charge is due."
866
+ },
867
+ "net_cents": {
868
+ "type": "integer",
869
+ "minimum": -9007199254740991,
870
+ "maximum": 9007199254740991,
871
+ "description": "The next charge, excluding VAT, in integer cents."
872
+ },
873
+ "vat_cents": {
874
+ "type": "integer",
875
+ "minimum": -9007199254740991,
876
+ "maximum": 9007199254740991,
877
+ "description": "VAT on the next charge, in integer cents."
878
+ },
879
+ "gross_cents": {
880
+ "type": "integer",
881
+ "minimum": -9007199254740991,
882
+ "maximum": 9007199254740991,
883
+ "description": "The next charge including VAT, in integer cents."
884
+ }
885
+ },
886
+ "required": [
887
+ "at",
888
+ "net_cents",
889
+ "vat_cents",
890
+ "gross_cents"
891
+ ],
892
+ "additionalProperties": false
893
+ },
894
+ {
895
+ "type": "null"
896
+ }
897
+ ],
898
+ "description": "`null` while a cancel is pending or nothing else renews."
899
+ },
900
+ "scheduled": {
901
+ "type": "object",
902
+ "properties": {
903
+ "cycle": {
904
+ "anyOf": [
905
+ {
906
+ "type": "string",
907
+ "enum": [
908
+ "monthly",
909
+ "yearly"
910
+ ]
911
+ },
912
+ {
913
+ "type": "null"
914
+ }
915
+ ],
916
+ "description": "A cycle change queued for the period's end, or `null`."
917
+ },
918
+ "addons": {
919
+ "anyOf": [
920
+ {
921
+ "type": "object",
922
+ "properties": {
923
+ "seats": {
924
+ "type": "integer",
925
+ "minimum": 0,
926
+ "maximum": 9007199254740991,
927
+ "description": "Extra developer seats, one each."
928
+ },
929
+ "robots": {
930
+ "type": "integer",
931
+ "minimum": 0,
932
+ "maximum": 9007199254740991,
933
+ "description": "Extra robots, one each."
934
+ },
935
+ "apps": {
936
+ "type": "integer",
937
+ "minimum": 0,
938
+ "maximum": 9007199254740991,
939
+ "description": "Extra apps, one each."
940
+ },
941
+ "app_user_packs": {
942
+ "type": "integer",
943
+ "minimum": 0,
944
+ "maximum": 9007199254740991,
945
+ "description": "Packs of five extra app users."
946
+ },
947
+ "live_video_packs": {
948
+ "type": "integer",
949
+ "minimum": 0,
950
+ "maximum": 9007199254740991,
951
+ "description": "Packs of 250 extra hours of app-user live video per month."
952
+ }
953
+ },
954
+ "required": [
955
+ "seats",
956
+ "robots",
957
+ "apps",
958
+ "app_user_packs",
959
+ "live_video_packs"
960
+ ],
961
+ "additionalProperties": false
962
+ },
963
+ {
964
+ "type": "null"
965
+ }
966
+ ],
967
+ "description": "Add-on counts queued for the period's end, or `null`."
968
+ }
969
+ },
970
+ "required": [
971
+ "cycle",
972
+ "addons"
973
+ ],
974
+ "additionalProperties": false,
975
+ "description": "What takes effect at the period's end."
976
+ },
977
+ "dunning": {
978
+ "anyOf": [
979
+ {
980
+ "type": "object",
981
+ "properties": {
982
+ "invoice_id": {
983
+ "type": "string",
984
+ "format": "uuid",
985
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
986
+ "description": "The open invoice dunning is chasing — or, while the payer's VAT ID is unsettled, the due charge that becomes one: it has no number yet and is not in `invoices`. `POST /api/billing/invoices/:id/pay` takes either."
987
+ },
988
+ "gross_cents": {
989
+ "type": "integer",
990
+ "minimum": -9007199254740991,
991
+ "maximum": 9007199254740991,
992
+ "description": "The amount owed, in integer cents — after a partial chargeback only the charged-back part."
993
+ },
994
+ "due_at": {
995
+ "type": "string",
996
+ "format": "date-time",
997
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
998
+ "description": "The charge's due date; retries and the lock count from here."
999
+ },
1000
+ "next_retry_at": {
1001
+ "anyOf": [
1002
+ {
1003
+ "type": "string",
1004
+ "format": "date-time",
1005
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
1006
+ },
1007
+ {
1008
+ "type": "null"
1009
+ }
1010
+ ],
1011
+ "description": "The next automatic retry, or `null` once retries are exhausted. Always `null` after a chargeback: a charged-back payment is never charged again automatically."
1012
+ },
1013
+ "lock_at": {
1014
+ "type": "string",
1015
+ "format": "date-time",
1016
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
1017
+ "description": "When the org is locked if still unpaid (`BILLING_LOCK_DAY`)."
1018
+ },
1019
+ "failure": {
1020
+ "anyOf": [
1021
+ {
1022
+ "type": "string"
1023
+ },
1024
+ {
1025
+ "type": "null"
1026
+ }
1027
+ ],
1028
+ "description": "Mollie's own reason, e.g. 'card_expired'; 'vat_id_invalid' while a renewal is held because VIES does not confirm the VAT ID; 'charged_back' after a chargeback or a lost PayPal dispute."
1029
+ }
1030
+ },
1031
+ "required": [
1032
+ "invoice_id",
1033
+ "gross_cents",
1034
+ "due_at",
1035
+ "next_retry_at",
1036
+ "lock_at",
1037
+ "failure"
1038
+ ],
1039
+ "additionalProperties": false
1040
+ },
1041
+ {
1042
+ "type": "null"
1043
+ }
1044
+ ],
1045
+ "description": "`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced."
1046
+ }
1047
+ },
1048
+ "required": [
1049
+ "payer",
1050
+ "vat_id_status",
1051
+ "vat",
1052
+ "currency",
1053
+ "cycle",
1054
+ "status",
1055
+ "period_starts_at",
1056
+ "period_ends_at",
1057
+ "next_charge",
1058
+ "scheduled",
1059
+ "dunning"
1060
+ ],
1061
+ "additionalProperties": false
1062
+ },
1063
+ {
1064
+ "type": "null"
1065
+ }
1066
+ ],
1067
+ "description": "`null` before the org has ever checked out."
1068
+ },
1069
+ "payment_method": {
1070
+ "anyOf": [
1071
+ {
1072
+ "oneOf": [
1073
+ {
1074
+ "type": "object",
1075
+ "properties": {
1076
+ "kind": {
1077
+ "type": "string",
1078
+ "const": "card",
1079
+ "description": "A card mandate."
1080
+ },
1081
+ "brand": {
1082
+ "type": "string",
1083
+ "description": "The card network, as Mollie's mandate reports it, e.g. 'Visa'."
1084
+ },
1085
+ "last4": {
1086
+ "type": "string",
1087
+ "pattern": "^\\d{4}$",
1088
+ "description": "The last four digits of the card."
1089
+ },
1090
+ "expires": {
1091
+ "type": "string",
1092
+ "pattern": "^\\d{2}\\/\\d{2}$",
1093
+ "description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
1094
+ }
1095
+ },
1096
+ "required": [
1097
+ "kind",
1098
+ "brand",
1099
+ "last4",
1100
+ "expires"
1101
+ ],
1102
+ "additionalProperties": false
1103
+ },
1104
+ {
1105
+ "type": "object",
1106
+ "properties": {
1107
+ "kind": {
1108
+ "type": "string",
1109
+ "const": "applepay",
1110
+ "description": "A card mandate from an Apple Pay first payment — Mollie stores it as `creditcard`; Fleetless labels it Apple Pay."
1111
+ },
1112
+ "brand": {
1113
+ "type": "string",
1114
+ "description": "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'."
1115
+ },
1116
+ "last4": {
1117
+ "type": "string",
1118
+ "pattern": "^\\d{4}$",
1119
+ "description": "The last four digits of the card behind Apple Pay."
1120
+ },
1121
+ "expires": {
1122
+ "type": "string",
1123
+ "pattern": "^\\d{2}\\/\\d{2}$",
1124
+ "description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
1125
+ }
1126
+ },
1127
+ "required": [
1128
+ "kind",
1129
+ "brand",
1130
+ "last4",
1131
+ "expires"
1132
+ ],
1133
+ "additionalProperties": false
1134
+ },
1135
+ {
1136
+ "type": "object",
1137
+ "properties": {
1138
+ "kind": {
1139
+ "type": "string",
1140
+ "const": "paypal",
1141
+ "description": "A PayPal mandate."
1142
+ },
1143
+ "account": {
1144
+ "type": "string",
1145
+ "description": "The PayPal account Mollie's mandate names."
1146
+ }
1147
+ },
1148
+ "required": [
1149
+ "kind",
1150
+ "account"
1151
+ ],
1152
+ "additionalProperties": false
1153
+ }
1154
+ ]
1155
+ },
1156
+ {
1157
+ "type": "null"
1158
+ }
1159
+ ],
1160
+ "description": "The payment method on file, or `null`."
1161
+ },
1162
+ "payment_method_options": {
1163
+ "type": "array",
1164
+ "items": {
1165
+ "type": "object",
1166
+ "properties": {
1167
+ "method": {
1168
+ "type": "string",
1169
+ "enum": [
1170
+ "card",
1171
+ "paypal",
1172
+ "applepay"
1173
+ ],
1174
+ "description": "A method `POST /api/billing/payment-method` accepts now."
1175
+ },
1176
+ "pays_invoice": {
1177
+ "type": "boolean",
1178
+ "description": "Whether changing to it also pays the open invoice — `true` only for `applepay` when a zero-amount Apple Pay payment is not available."
1179
+ }
1180
+ },
1181
+ "required": [
1182
+ "method",
1183
+ "pays_invoice"
1184
+ ],
1185
+ "additionalProperties": false
1186
+ },
1187
+ "description": "What a payment-method change may offer right now, so a client offers exactly what the cloud accepts. `applepay` is absent when it needs an open invoice and none is open; `[]` when the org has no billing account."
1188
+ },
1189
+ "invoices": {
1190
+ "type": "array",
1191
+ "items": {
1192
+ "type": "object",
1193
+ "properties": {
1194
+ "id": {
1195
+ "type": "string",
1196
+ "format": "uuid",
1197
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
1198
+ "description": "The invoice's id."
1199
+ },
1200
+ "number": {
1201
+ "type": "string",
1202
+ "pattern": "^FL-\\d{4}-\\d{4,}$",
1203
+ "description": "The invoice number: `FL-<year>-<seq>`, `seq` zero-padded to four digits, gapless per calendar year in `Europe/Berlin`."
1204
+ },
1205
+ "issued_at": {
1206
+ "type": "string",
1207
+ "format": "date-time",
1208
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
1209
+ "description": "When the invoice was issued."
1210
+ },
1211
+ "status": {
1212
+ "type": "string",
1213
+ "enum": [
1214
+ "open",
1215
+ "paid",
1216
+ "uncollectible"
1217
+ ],
1218
+ "description": "This invoice's own status."
1219
+ },
1220
+ "currency": {
1221
+ "type": "string",
1222
+ "enum": [
1223
+ "eur",
1224
+ "usd"
1225
+ ],
1226
+ "description": "The org's billing currency."
1227
+ },
1228
+ "net_cents": {
1229
+ "type": "integer",
1230
+ "minimum": 0,
1231
+ "maximum": 9007199254740991,
1232
+ "description": "The charge, excluding VAT, in integer cents."
1233
+ },
1234
+ "vat_rate_percent": {
1235
+ "type": "integer",
1236
+ "minimum": 0,
1237
+ "maximum": 100,
1238
+ "description": "The VAT rate applied, in whole percent."
1239
+ },
1240
+ "vat_cents": {
1241
+ "type": "integer",
1242
+ "minimum": 0,
1243
+ "maximum": 9007199254740991,
1244
+ "description": "VAT, in integer cents (`vatCents`)."
1245
+ },
1246
+ "gross_cents": {
1247
+ "type": "integer",
1248
+ "minimum": 0,
1249
+ "maximum": 9007199254740991,
1250
+ "description": "Net plus VAT, in integer cents."
1251
+ }
1252
+ },
1253
+ "required": [
1254
+ "id",
1255
+ "number",
1256
+ "issued_at",
1257
+ "status",
1258
+ "currency",
1259
+ "net_cents",
1260
+ "vat_rate_percent",
1261
+ "vat_cents",
1262
+ "gross_cents"
1263
+ ],
1264
+ "additionalProperties": false
1265
+ },
1266
+ "description": "Newest first, at most 24."
1267
+ }
1268
+ },
1269
+ "required": [
1270
+ "available",
1271
+ "account",
1272
+ "payment_method",
1273
+ "payment_method_options",
1274
+ "invoices"
1275
+ ],
1276
+ "additionalProperties": false,
1277
+ "description": "The billing view after the change."
1278
+ },
1279
+ "charged": {
1280
+ "anyOf": [
1281
+ {
1282
+ "type": "object",
1283
+ "properties": {
1284
+ "id": {
1285
+ "type": "string",
1286
+ "format": "uuid",
1287
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
1288
+ "description": "The invoice's id."
1289
+ },
1290
+ "number": {
1291
+ "type": "string",
1292
+ "pattern": "^FL-\\d{4}-\\d{4,}$",
1293
+ "description": "The invoice number: `FL-<year>-<seq>`, `seq` zero-padded to four digits, gapless per calendar year in `Europe/Berlin`."
1294
+ },
1295
+ "issued_at": {
1296
+ "type": "string",
1297
+ "format": "date-time",
1298
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
1299
+ "description": "When the invoice was issued."
1300
+ },
1301
+ "status": {
1302
+ "type": "string",
1303
+ "enum": [
1304
+ "open",
1305
+ "paid",
1306
+ "uncollectible"
1307
+ ],
1308
+ "description": "This invoice's own status."
1309
+ },
1310
+ "currency": {
1311
+ "type": "string",
1312
+ "enum": [
1313
+ "eur",
1314
+ "usd"
1315
+ ],
1316
+ "description": "The org's billing currency."
1317
+ },
1318
+ "net_cents": {
1319
+ "type": "integer",
1320
+ "minimum": 0,
1321
+ "maximum": 9007199254740991,
1322
+ "description": "The charge, excluding VAT, in integer cents."
1323
+ },
1324
+ "vat_rate_percent": {
1325
+ "type": "integer",
1326
+ "minimum": 0,
1327
+ "maximum": 100,
1328
+ "description": "The VAT rate applied, in whole percent."
1329
+ },
1330
+ "vat_cents": {
1331
+ "type": "integer",
1332
+ "minimum": 0,
1333
+ "maximum": 9007199254740991,
1334
+ "description": "VAT, in integer cents (`vatCents`)."
1335
+ },
1336
+ "gross_cents": {
1337
+ "type": "integer",
1338
+ "minimum": 0,
1339
+ "maximum": 9007199254740991,
1340
+ "description": "Net plus VAT, in integer cents."
1341
+ }
1342
+ },
1343
+ "required": [
1344
+ "id",
1345
+ "number",
1346
+ "issued_at",
1347
+ "status",
1348
+ "currency",
1349
+ "net_cents",
1350
+ "vat_rate_percent",
1351
+ "vat_cents",
1352
+ "gross_cents"
1353
+ ],
1354
+ "additionalProperties": false
1355
+ },
1356
+ {
1357
+ "type": "null"
1358
+ }
1359
+ ],
1360
+ "description": "The invoice charged now, or `null` when the change was only scheduled for the period's end."
1361
+ },
1362
+ "intent": {
1363
+ "type": "object",
1364
+ "properties": {
1365
+ "intent_id": {
1366
+ "type": "string",
1367
+ "format": "uuid",
1368
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
1369
+ "description": "Opaque persisted purchase intent identity."
1370
+ },
1371
+ "operation_key": {
1372
+ "type": "string",
1373
+ "format": "uuid",
1374
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
1375
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
1376
+ },
1377
+ "operation": {
1378
+ "type": "string",
1379
+ "enum": [
1380
+ "checkout",
1381
+ "paid_change",
1382
+ "invoice_payment",
1383
+ "payment_method_invoice"
1384
+ ]
1385
+ },
1386
+ "invoice_id": {
1387
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
1388
+ "type": "string",
1389
+ "format": "uuid",
1390
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
1391
+ },
1392
+ "state": {
1393
+ "type": "string",
1394
+ "const": "payment_started"
1395
+ },
1396
+ "payment_id": {
1397
+ "type": "string",
1398
+ "format": "uuid",
1399
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
1400
+ },
1401
+ "payment": {
1402
+ "oneOf": [
1403
+ {
1404
+ "type": "object",
1405
+ "properties": {
1406
+ "kind": {
1407
+ "type": "string",
1408
+ "const": "hosted"
1409
+ },
1410
+ "checkout_id": {
1411
+ "type": "string",
1412
+ "format": "uuid",
1413
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
1414
+ },
1415
+ "checkout_url": {
1416
+ "type": "string",
1417
+ "format": "uri"
1418
+ }
1419
+ },
1420
+ "required": [
1421
+ "kind",
1422
+ "checkout_id",
1423
+ "checkout_url"
1424
+ ],
1425
+ "additionalProperties": false
1426
+ },
1427
+ {
1428
+ "type": "object",
1429
+ "properties": {
1430
+ "kind": {
1431
+ "type": "string",
1432
+ "const": "mandate"
1433
+ }
1434
+ },
1435
+ "required": [
1436
+ "kind"
1437
+ ],
1438
+ "additionalProperties": false
1439
+ }
1440
+ ]
1441
+ }
1442
+ },
1443
+ "required": [
1444
+ "intent_id",
1445
+ "operation_key",
1446
+ "operation",
1447
+ "state",
1448
+ "payment_id",
1449
+ "payment"
1450
+ ],
1451
+ "additionalProperties": false,
1452
+ "allOf": [
1453
+ {
1454
+ "if": {
1455
+ "properties": {
1456
+ "operation": {
1457
+ "enum": [
1458
+ "invoice_payment",
1459
+ "payment_method_invoice"
1460
+ ]
1461
+ }
1462
+ },
1463
+ "required": [
1464
+ "operation"
1465
+ ]
1466
+ },
1467
+ "then": {
1468
+ "required": [
1469
+ "invoice_id"
1470
+ ]
1471
+ }
1472
+ },
1473
+ {
1474
+ "if": {
1475
+ "properties": {
1476
+ "operation": {
1477
+ "const": "mandate_setup"
1478
+ }
1479
+ },
1480
+ "required": [
1481
+ "operation"
1482
+ ]
1483
+ },
1484
+ "then": {
1485
+ "properties": {
1486
+ "state": {
1487
+ "const": "held"
1488
+ },
1489
+ "reason": {
1490
+ "const": "mandate_policy_unresolved"
1491
+ }
1492
+ },
1493
+ "required": [
1494
+ "reason"
1495
+ ]
1496
+ }
1497
+ },
1498
+ {
1499
+ "if": {
1500
+ "properties": {
1501
+ "reason": {
1502
+ "const": "mandate_policy_unresolved"
1503
+ }
1504
+ },
1505
+ "required": [
1506
+ "reason"
1507
+ ]
1508
+ },
1509
+ "then": {
1510
+ "properties": {
1511
+ "operation": {
1512
+ "const": "mandate_setup"
1513
+ }
1514
+ }
1515
+ }
1516
+ },
1517
+ {
1518
+ "if": {
1519
+ "properties": {
1520
+ "payment": {
1521
+ "properties": {
1522
+ "kind": {
1523
+ "const": "mandate"
1524
+ }
1525
+ },
1526
+ "required": [
1527
+ "kind"
1528
+ ]
1529
+ }
1530
+ },
1531
+ "required": [
1532
+ "payment"
1533
+ ]
1534
+ },
1535
+ "then": {
1536
+ "properties": {
1537
+ "operation": {
1538
+ "const": "paid_change"
1539
+ }
1540
+ }
1541
+ }
1542
+ }
1543
+ ]
1544
+ }
1545
+ },
1546
+ "required": [
1547
+ "billing",
1548
+ "charged",
1549
+ "intent"
1550
+ ],
1551
+ "additionalProperties": false
1552
+ }
1553
+ ]
1554
+ }