@fleetless/contracts 6.5.0 → 7.0.0-next.1

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 +27 -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
@@ -1,393 +1,358 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "type": "object",
4
- "properties": {
5
- "billing": {
3
+ "anyOf": [
4
+ {
6
5
  "type": "object",
7
6
  "properties": {
8
- "available": {
9
- "type": "boolean",
10
- "description": "Whether this cloud takes payments at all — `false` when no Mollie key is configured."
11
- },
12
- "account": {
13
- "anyOf": [
14
- {
15
- "type": "object",
16
- "properties": {
17
- "payer": {
18
- "oneOf": [
19
- {
20
- "type": "object",
21
- "properties": {
22
- "kind": {
23
- "type": "string",
24
- "const": "company",
25
- "description": "Billed as a company."
26
- },
27
- "company_name": {
28
- "type": "string",
29
- "minLength": 1,
30
- "maxLength": 200,
31
- "description": "The company's legal name, printed on the invoice."
32
- },
33
- "vat_id": {
34
- "anyOf": [
35
- {
36
- "type": "string",
37
- "maxLength": 20
38
- },
39
- {
40
- "type": "null"
41
- }
42
- ],
43
- "description": "The company's VAT ID, or `null` for none. Required, and must check out through VIES, for a company outside Germany."
44
- },
45
- "address": {
7
+ "billing": {
8
+ "type": "object",
9
+ "properties": {
10
+ "available": {
11
+ "type": "boolean",
12
+ "description": "Whether this cloud takes payments at all — `false` when no Mollie key is configured."
13
+ },
14
+ "account": {
15
+ "anyOf": [
16
+ {
17
+ "type": "object",
18
+ "properties": {
19
+ "payer": {
20
+ "oneOf": [
21
+ {
46
22
  "type": "object",
47
23
  "properties": {
48
- "line1": {
24
+ "kind": {
25
+ "type": "string",
26
+ "const": "company",
27
+ "description": "Billed as a company."
28
+ },
29
+ "company_name": {
49
30
  "type": "string",
50
31
  "minLength": 1,
51
32
  "maxLength": 200,
52
- "description": "Street and number, or the first address line."
33
+ "description": "The company's legal name, printed on the invoice."
53
34
  },
54
- "line2": {
35
+ "vat_id": {
55
36
  "anyOf": [
56
37
  {
57
38
  "type": "string",
58
- "maxLength": 200
39
+ "maxLength": 20
59
40
  },
60
41
  {
61
42
  "type": "null"
62
43
  }
63
44
  ],
64
- "description": "A second address line, or `null` when there is none."
45
+ "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."
65
46
  },
66
- "postal_code": {
67
- "type": "string",
68
- "minLength": 1,
69
- "maxLength": 20,
70
- "description": "Postal or ZIP code."
47
+ "tax_id": {
48
+ "description": "Free-text Tax ID. Required for a new non-EU purchase; historical records may omit it.",
49
+ "anyOf": [
50
+ {
51
+ "type": "string",
52
+ "maxLength": 100
53
+ },
54
+ {
55
+ "type": "null"
56
+ }
57
+ ]
71
58
  },
72
- "city": {
73
- "type": "string",
74
- "minLength": 1,
75
- "maxLength": 100,
76
- "description": "City or town."
59
+ "address": {
60
+ "type": "object",
61
+ "properties": {
62
+ "line1": {
63
+ "type": "string",
64
+ "minLength": 1,
65
+ "maxLength": 200,
66
+ "description": "Street and number, or the first address line."
67
+ },
68
+ "line2": {
69
+ "anyOf": [
70
+ {
71
+ "type": "string",
72
+ "maxLength": 200
73
+ },
74
+ {
75
+ "type": "null"
76
+ }
77
+ ],
78
+ "description": "A second address line, or `null` when there is none."
79
+ },
80
+ "postal_code": {
81
+ "type": "string",
82
+ "minLength": 1,
83
+ "maxLength": 20,
84
+ "description": "Postal or ZIP code."
85
+ },
86
+ "city": {
87
+ "type": "string",
88
+ "minLength": 1,
89
+ "maxLength": 100,
90
+ "description": "City or town."
91
+ },
92
+ "country": {
93
+ "type": "string",
94
+ "pattern": "^[A-Z]{2}$",
95
+ "description": "The billing country, used for purchase eligibility and VAT."
96
+ },
97
+ "state": {
98
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
99
+ "type": "string",
100
+ "minLength": 1,
101
+ "maxLength": 100
102
+ }
103
+ },
104
+ "required": [
105
+ "line1",
106
+ "line2",
107
+ "postal_code",
108
+ "city",
109
+ "country"
110
+ ],
111
+ "additionalProperties": false,
112
+ "description": "The billing address."
77
113
  },
78
- "country": {
114
+ "invoice_email": {
79
115
  "type": "string",
80
- "pattern": "^[A-Z]{2}$",
81
- "description": "The billing country. Decides VAT (`vatFor`) and currency (`currencyForCountry`)."
116
+ "format": "email",
117
+ "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
118
+ "description": "Where invoices and billing mail are sent."
82
119
  }
83
120
  },
84
121
  "required": [
85
- "line1",
86
- "line2",
87
- "postal_code",
88
- "city",
89
- "country"
122
+ "kind",
123
+ "company_name",
124
+ "vat_id",
125
+ "address",
126
+ "invoice_email"
90
127
  ],
91
128
  "additionalProperties": false,
92
- "description": "The billing address."
93
- },
94
- "invoice_email": {
95
- "type": "string",
96
- "format": "email",
97
- "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
98
- "description": "Where invoices and billing mail are sent."
99
- }
100
- },
101
- "required": [
102
- "kind",
103
- "company_name",
104
- "vat_id",
105
- "address",
106
- "invoice_email"
107
- ],
108
- "additionalProperties": false,
109
- "description": "A company: name and an optional VAT ID, never 'full name'."
110
- },
111
- {
112
- "type": "object",
113
- "properties": {
114
- "kind": {
115
- "type": "string",
116
- "const": "person",
117
- "description": "Billed as a person."
118
- },
119
- "full_name": {
120
- "type": "string",
121
- "minLength": 1,
122
- "maxLength": 200,
123
- "description": "The person's full name, printed on the invoice."
129
+ "description": "A company: name and an optional VAT ID, never 'full name'."
124
130
  },
125
- "address": {
131
+ {
126
132
  "type": "object",
127
133
  "properties": {
128
- "line1": {
134
+ "kind": {
135
+ "type": "string",
136
+ "const": "person",
137
+ "description": "Billed as a person."
138
+ },
139
+ "full_name": {
129
140
  "type": "string",
130
141
  "minLength": 1,
131
142
  "maxLength": 200,
132
- "description": "Street and number, or the first address line."
143
+ "description": "The person's full name, printed on the invoice."
133
144
  },
134
- "line2": {
135
- "anyOf": [
136
- {
145
+ "address": {
146
+ "type": "object",
147
+ "properties": {
148
+ "line1": {
137
149
  "type": "string",
138
- "maxLength": 200
150
+ "minLength": 1,
151
+ "maxLength": 200,
152
+ "description": "Street and number, or the first address line."
139
153
  },
140
- {
141
- "type": "null"
154
+ "line2": {
155
+ "anyOf": [
156
+ {
157
+ "type": "string",
158
+ "maxLength": 200
159
+ },
160
+ {
161
+ "type": "null"
162
+ }
163
+ ],
164
+ "description": "A second address line, or `null` when there is none."
165
+ },
166
+ "postal_code": {
167
+ "type": "string",
168
+ "minLength": 1,
169
+ "maxLength": 20,
170
+ "description": "Postal or ZIP code."
171
+ },
172
+ "city": {
173
+ "type": "string",
174
+ "minLength": 1,
175
+ "maxLength": 100,
176
+ "description": "City or town."
177
+ },
178
+ "country": {
179
+ "type": "string",
180
+ "pattern": "^[A-Z]{2}$",
181
+ "description": "The billing country, used for purchase eligibility and VAT."
182
+ },
183
+ "state": {
184
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
185
+ "type": "string",
186
+ "minLength": 1,
187
+ "maxLength": 100
142
188
  }
189
+ },
190
+ "required": [
191
+ "line1",
192
+ "line2",
193
+ "postal_code",
194
+ "city",
195
+ "country"
143
196
  ],
144
- "description": "A second address line, or `null` when there is none."
197
+ "additionalProperties": false,
198
+ "description": "The billing address."
145
199
  },
146
- "postal_code": {
200
+ "invoice_email": {
147
201
  "type": "string",
148
- "minLength": 1,
149
- "maxLength": 20,
150
- "description": "Postal or ZIP code."
151
- },
152
- "city": {
202
+ "format": "email",
203
+ "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
204
+ "description": "Where invoices and billing mail are sent."
205
+ }
206
+ },
207
+ "required": [
208
+ "kind",
209
+ "full_name",
210
+ "address",
211
+ "invoice_email"
212
+ ],
213
+ "additionalProperties": false,
214
+ "description": "A person: a full name, never a VAT ID — only a company can be VAT-registered."
215
+ }
216
+ ],
217
+ "description": "Who is paying, and the invoice address and email."
218
+ },
219
+ "vat_id_status": {
220
+ "anyOf": [
221
+ {
222
+ "type": "string",
223
+ "enum": [
224
+ "valid",
225
+ "unverified",
226
+ "invalid",
227
+ "unavailable"
228
+ ]
229
+ },
230
+ {
231
+ "type": "null"
232
+ }
233
+ ],
234
+ "description": "The payer's VAT ID check, or `null` when no VAT ID was given."
235
+ },
236
+ "vat": {
237
+ "anyOf": [
238
+ {
239
+ "type": "object",
240
+ "properties": {
241
+ "treatment": {
153
242
  "type": "string",
154
- "minLength": 1,
155
- "maxLength": 100,
156
- "description": "City or town."
243
+ "enum": [
244
+ "de_standard",
245
+ "reverse_charge",
246
+ "outside_eu"
247
+ ],
248
+ "description": "How the account is taxed."
157
249
  },
158
- "country": {
159
- "type": "string",
160
- "pattern": "^[A-Z]{2}$",
161
- "description": "The billing country. Decides VAT (`vatFor`) and currency (`currencyForCountry`)."
250
+ "rate_percent": {
251
+ "type": "integer",
252
+ "minimum": -9007199254740991,
253
+ "maximum": 9007199254740991,
254
+ "description": "The VAT rate, in whole percent."
162
255
  }
163
256
  },
164
257
  "required": [
165
- "line1",
166
- "line2",
167
- "postal_code",
168
- "city",
169
- "country"
258
+ "treatment",
259
+ "rate_percent"
170
260
  ],
171
- "additionalProperties": false,
172
- "description": "The billing address."
261
+ "additionalProperties": false
173
262
  },
174
- "invoice_email": {
175
- "type": "string",
176
- "format": "email",
177
- "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
178
- "description": "Where invoices and billing mail are sent."
263
+ {
264
+ "type": "null"
179
265
  }
180
- },
181
- "required": [
182
- "kind",
183
- "full_name",
184
- "address",
185
- "invoice_email"
186
266
  ],
187
- "additionalProperties": false,
188
- "description": "A person: a full name, never a VAT ID — only a company can be VAT-registered."
189
- }
190
- ],
191
- "description": "Who is paying, and the invoice address and email."
192
- },
193
- "vat_id_status": {
194
- "anyOf": [
195
- {
196
- "type": "string",
197
- "enum": [
198
- "valid",
199
- "unverified",
200
- "invalid"
201
- ]
267
+ "description": "Recorded VAT treatment; null while the current buyer has no eligible decision. Never infer zero rating from a pending account."
202
268
  },
203
- {
204
- "type": "null"
205
- }
206
- ],
207
- "description": "The payer's VAT ID check, or `null` when no VAT ID was given."
208
- },
209
- "vat": {
210
- "type": "object",
211
- "properties": {
212
- "treatment": {
269
+ "currency": {
213
270
  "type": "string",
214
271
  "enum": [
215
- "de_standard",
216
- "reverse_charge",
217
- "outside_eu"
272
+ "eur",
273
+ "usd"
218
274
  ],
219
- "description": "How the account is taxed."
275
+ "description": "The org's billing currency, fixed at the first payment."
220
276
  },
221
- "rate_percent": {
222
- "type": "integer",
223
- "minimum": -9007199254740991,
224
- "maximum": 9007199254740991,
225
- "description": "The VAT rate, in whole percent."
226
- }
227
- },
228
- "required": [
229
- "treatment",
230
- "rate_percent"
231
- ],
232
- "additionalProperties": false,
233
- "description": "The VAT treatment and rate this account charges at (`vatFor`)."
234
- },
235
- "currency": {
236
- "type": "string",
237
- "enum": [
238
- "eur",
239
- "usd"
240
- ],
241
- "description": "The org's billing currency, fixed at the first payment."
242
- },
243
- "cycle": {
244
- "type": "string",
245
- "enum": [
246
- "monthly",
247
- "yearly"
248
- ],
249
- "description": "The current billing cycle."
250
- },
251
- "status": {
252
- "type": "string",
253
- "enum": [
254
- "pending",
255
- "active",
256
- "past_due",
257
- "canceled"
258
- ],
259
- "description": "The account's own status."
260
- },
261
- "period_starts_at": {
262
- "anyOf": [
263
- {
277
+ "cycle": {
264
278
  "type": "string",
265
- "format": "date-time",
266
- "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))$"
279
+ "enum": [
280
+ "monthly",
281
+ "yearly"
282
+ ],
283
+ "description": "The current billing cycle."
267
284
  },
268
- {
269
- "type": "null"
270
- }
271
- ],
272
- "description": "The current period's start. `null` before the first payment."
273
- },
274
- "period_ends_at": {
275
- "anyOf": [
276
- {
285
+ "status": {
277
286
  "type": "string",
278
- "format": "date-time",
279
- "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))$"
287
+ "enum": [
288
+ "pending",
289
+ "active",
290
+ "past_due",
291
+ "canceled"
292
+ ],
293
+ "description": "The account's own status."
280
294
  },
281
- {
282
- "type": "null"
283
- }
284
- ],
285
- "description": "The current period's end. `null` before the first payment."
286
- },
287
- "next_charge": {
288
- "anyOf": [
289
- {
290
- "type": "object",
291
- "properties": {
292
- "at": {
295
+ "period_starts_at": {
296
+ "anyOf": [
297
+ {
293
298
  "type": "string",
294
299
  "format": "date-time",
295
- "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))$",
296
- "description": "When the next charge is due."
297
- },
298
- "net_cents": {
299
- "type": "integer",
300
- "minimum": -9007199254740991,
301
- "maximum": 9007199254740991,
302
- "description": "The next charge, excluding VAT, in integer cents."
303
- },
304
- "vat_cents": {
305
- "type": "integer",
306
- "minimum": -9007199254740991,
307
- "maximum": 9007199254740991,
308
- "description": "VAT on the next charge, in integer cents."
309
- },
310
- "gross_cents": {
311
- "type": "integer",
312
- "minimum": -9007199254740991,
313
- "maximum": 9007199254740991,
314
- "description": "The next charge including VAT, in integer cents."
300
+ "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))$"
301
+ },
302
+ {
303
+ "type": "null"
315
304
  }
316
- },
317
- "required": [
318
- "at",
319
- "net_cents",
320
- "vat_cents",
321
- "gross_cents"
322
305
  ],
323
- "additionalProperties": false
306
+ "description": "The current period's start. `null` before the first payment."
324
307
  },
325
- {
326
- "type": "null"
327
- }
328
- ],
329
- "description": "`null` while a cancel is pending or nothing else renews."
330
- },
331
- "scheduled": {
332
- "type": "object",
333
- "properties": {
334
- "cycle": {
308
+ "period_ends_at": {
335
309
  "anyOf": [
336
310
  {
337
311
  "type": "string",
338
- "enum": [
339
- "monthly",
340
- "yearly"
341
- ]
312
+ "format": "date-time",
313
+ "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))$"
342
314
  },
343
315
  {
344
316
  "type": "null"
345
317
  }
346
318
  ],
347
- "description": "A cycle change queued for the period's end, or `null`."
319
+ "description": "The current period's end. `null` before the first payment."
348
320
  },
349
- "addons": {
321
+ "next_charge": {
350
322
  "anyOf": [
351
323
  {
352
324
  "type": "object",
353
325
  "properties": {
354
- "seats": {
355
- "type": "integer",
356
- "minimum": 0,
357
- "maximum": 9007199254740991,
358
- "description": "Extra developer seats, one each."
359
- },
360
- "robots": {
361
- "type": "integer",
362
- "minimum": 0,
363
- "maximum": 9007199254740991,
364
- "description": "Extra robots, one each."
326
+ "at": {
327
+ "type": "string",
328
+ "format": "date-time",
329
+ "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))$",
330
+ "description": "When the next charge is due."
365
331
  },
366
- "apps": {
332
+ "net_cents": {
367
333
  "type": "integer",
368
- "minimum": 0,
334
+ "minimum": -9007199254740991,
369
335
  "maximum": 9007199254740991,
370
- "description": "Extra apps, one each."
336
+ "description": "The next charge, excluding VAT, in integer cents."
371
337
  },
372
- "app_user_packs": {
338
+ "vat_cents": {
373
339
  "type": "integer",
374
- "minimum": 0,
340
+ "minimum": -9007199254740991,
375
341
  "maximum": 9007199254740991,
376
- "description": "Packs of five extra app users."
342
+ "description": "VAT on the next charge, in integer cents."
377
343
  },
378
- "live_video_packs": {
344
+ "gross_cents": {
379
345
  "type": "integer",
380
- "minimum": 0,
346
+ "minimum": -9007199254740991,
381
347
  "maximum": 9007199254740991,
382
- "description": "Packs of 250 extra hours of app-user live video per month."
348
+ "description": "The next charge including VAT, in integer cents."
383
349
  }
384
350
  },
385
351
  "required": [
386
- "seats",
387
- "robots",
388
- "apps",
389
- "app_user_packs",
390
- "live_video_packs"
352
+ "at",
353
+ "net_cents",
354
+ "vat_cents",
355
+ "gross_cents"
391
356
  ],
392
357
  "additionalProperties": false
393
358
  },
@@ -395,171 +360,1906 @@
395
360
  "type": "null"
396
361
  }
397
362
  ],
398
- "description": "Add-on counts queued for the period's end, or `null`."
399
- }
400
- },
401
- "required": [
402
- "cycle",
403
- "addons"
404
- ],
405
- "additionalProperties": false,
406
- "description": "What takes effect at the period's end."
407
- },
408
- "dunning": {
409
- "anyOf": [
410
- {
363
+ "description": "`null` while a cancel is pending or nothing else renews."
364
+ },
365
+ "scheduled": {
411
366
  "type": "object",
412
367
  "properties": {
413
- "invoice_id": {
414
- "type": "string",
415
- "format": "uuid",
416
- "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)$",
417
- "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."
418
- },
419
- "gross_cents": {
420
- "type": "integer",
421
- "minimum": -9007199254740991,
422
- "maximum": 9007199254740991,
423
- "description": "The amount owed, in integer cents — after a partial chargeback only the charged-back part."
424
- },
425
- "due_at": {
426
- "type": "string",
427
- "format": "date-time",
428
- "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))$",
429
- "description": "The charge's due date; retries and the lock count from here."
430
- },
431
- "next_retry_at": {
368
+ "cycle": {
432
369
  "anyOf": [
433
370
  {
434
371
  "type": "string",
435
- "format": "date-time",
436
- "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))$"
372
+ "enum": [
373
+ "monthly",
374
+ "yearly"
375
+ ]
437
376
  },
438
377
  {
439
378
  "type": "null"
440
379
  }
441
380
  ],
442
- "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."
443
- },
444
- "lock_at": {
445
- "type": "string",
446
- "format": "date-time",
447
- "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))$",
448
- "description": "When the org is locked if still unpaid (`BILLING_LOCK_DAY`)."
381
+ "description": "A cycle change queued for the period's end, or `null`."
449
382
  },
450
- "failure": {
383
+ "addons": {
451
384
  "anyOf": [
452
385
  {
453
- "type": "string"
386
+ "type": "object",
387
+ "properties": {
388
+ "seats": {
389
+ "type": "integer",
390
+ "minimum": 0,
391
+ "maximum": 9007199254740991,
392
+ "description": "Extra developer seats, one each."
393
+ },
394
+ "robots": {
395
+ "type": "integer",
396
+ "minimum": 0,
397
+ "maximum": 9007199254740991,
398
+ "description": "Extra robots, one each."
399
+ },
400
+ "apps": {
401
+ "type": "integer",
402
+ "minimum": 0,
403
+ "maximum": 9007199254740991,
404
+ "description": "Extra apps, one each."
405
+ },
406
+ "app_user_packs": {
407
+ "type": "integer",
408
+ "minimum": 0,
409
+ "maximum": 9007199254740991,
410
+ "description": "Packs of five extra app users."
411
+ },
412
+ "live_video_packs": {
413
+ "type": "integer",
414
+ "minimum": 0,
415
+ "maximum": 9007199254740991,
416
+ "description": "Packs of 250 extra hours of app-user live video per month."
417
+ }
418
+ },
419
+ "required": [
420
+ "seats",
421
+ "robots",
422
+ "apps",
423
+ "app_user_packs",
424
+ "live_video_packs"
425
+ ],
426
+ "additionalProperties": false
454
427
  },
455
428
  {
456
429
  "type": "null"
457
430
  }
458
431
  ],
459
- "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."
432
+ "description": "Add-on counts queued for the period's end, or `null`."
460
433
  }
461
434
  },
462
435
  "required": [
463
- "invoice_id",
464
- "gross_cents",
465
- "due_at",
466
- "next_retry_at",
467
- "lock_at",
468
- "failure"
436
+ "cycle",
437
+ "addons"
469
438
  ],
470
- "additionalProperties": false
439
+ "additionalProperties": false,
440
+ "description": "What takes effect at the period's end."
471
441
  },
472
- {
473
- "type": "null"
474
- }
475
- ],
476
- "description": "`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced."
477
- }
478
- },
479
- "required": [
480
- "payer",
481
- "vat_id_status",
482
- "vat",
483
- "currency",
484
- "cycle",
485
- "status",
486
- "period_starts_at",
487
- "period_ends_at",
488
- "next_charge",
489
- "scheduled",
490
- "dunning"
491
- ],
492
- "additionalProperties": false
493
- },
494
- {
495
- "type": "null"
496
- }
497
- ],
498
- "description": "`null` before the org has ever checked out."
499
- },
500
- "payment_method": {
501
- "anyOf": [
502
- {
503
- "oneOf": [
504
- {
505
- "type": "object",
506
- "properties": {
507
- "kind": {
442
+ "dunning": {
443
+ "anyOf": [
444
+ {
445
+ "type": "object",
446
+ "properties": {
447
+ "invoice_id": {
448
+ "type": "string",
449
+ "format": "uuid",
450
+ "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)$",
451
+ "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."
452
+ },
453
+ "gross_cents": {
454
+ "type": "integer",
455
+ "minimum": -9007199254740991,
456
+ "maximum": 9007199254740991,
457
+ "description": "The amount owed, in integer cents — after a partial chargeback only the charged-back part."
458
+ },
459
+ "due_at": {
460
+ "type": "string",
461
+ "format": "date-time",
462
+ "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))$",
463
+ "description": "The charge's due date; retries and the lock count from here."
464
+ },
465
+ "next_retry_at": {
466
+ "anyOf": [
467
+ {
468
+ "type": "string",
469
+ "format": "date-time",
470
+ "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))$"
471
+ },
472
+ {
473
+ "type": "null"
474
+ }
475
+ ],
476
+ "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."
477
+ },
478
+ "lock_at": {
479
+ "type": "string",
480
+ "format": "date-time",
481
+ "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))$",
482
+ "description": "When the org is locked if still unpaid (`BILLING_LOCK_DAY`)."
483
+ },
484
+ "failure": {
485
+ "anyOf": [
486
+ {
487
+ "type": "string"
488
+ },
489
+ {
490
+ "type": "null"
491
+ }
492
+ ],
493
+ "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."
494
+ }
495
+ },
496
+ "required": [
497
+ "invoice_id",
498
+ "gross_cents",
499
+ "due_at",
500
+ "next_retry_at",
501
+ "lock_at",
502
+ "failure"
503
+ ],
504
+ "additionalProperties": false
505
+ },
506
+ {
507
+ "type": "null"
508
+ }
509
+ ],
510
+ "description": "`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced."
511
+ }
512
+ },
513
+ "required": [
514
+ "payer",
515
+ "vat_id_status",
516
+ "vat",
517
+ "currency",
518
+ "cycle",
519
+ "status",
520
+ "period_starts_at",
521
+ "period_ends_at",
522
+ "next_charge",
523
+ "scheduled",
524
+ "dunning"
525
+ ],
526
+ "additionalProperties": false
527
+ },
528
+ {
529
+ "type": "null"
530
+ }
531
+ ],
532
+ "description": "`null` before the org has ever checked out."
533
+ },
534
+ "payment_method": {
535
+ "anyOf": [
536
+ {
537
+ "oneOf": [
538
+ {
539
+ "type": "object",
540
+ "properties": {
541
+ "kind": {
542
+ "type": "string",
543
+ "const": "card",
544
+ "description": "A card mandate."
545
+ },
546
+ "brand": {
547
+ "type": "string",
548
+ "description": "The card network, as Mollie's mandate reports it, e.g. 'Visa'."
549
+ },
550
+ "last4": {
551
+ "type": "string",
552
+ "pattern": "^\\d{4}$",
553
+ "description": "The last four digits of the card."
554
+ },
555
+ "expires": {
556
+ "type": "string",
557
+ "pattern": "^\\d{2}\\/\\d{2}$",
558
+ "description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
559
+ }
560
+ },
561
+ "required": [
562
+ "kind",
563
+ "brand",
564
+ "last4",
565
+ "expires"
566
+ ],
567
+ "additionalProperties": false
568
+ },
569
+ {
570
+ "type": "object",
571
+ "properties": {
572
+ "kind": {
573
+ "type": "string",
574
+ "const": "applepay",
575
+ "description": "A card mandate from an Apple Pay first payment — Mollie stores it as `creditcard`; Fleetless labels it Apple Pay."
576
+ },
577
+ "brand": {
578
+ "type": "string",
579
+ "description": "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'."
580
+ },
581
+ "last4": {
582
+ "type": "string",
583
+ "pattern": "^\\d{4}$",
584
+ "description": "The last four digits of the card behind Apple Pay."
585
+ },
586
+ "expires": {
587
+ "type": "string",
588
+ "pattern": "^\\d{2}\\/\\d{2}$",
589
+ "description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
590
+ }
591
+ },
592
+ "required": [
593
+ "kind",
594
+ "brand",
595
+ "last4",
596
+ "expires"
597
+ ],
598
+ "additionalProperties": false
599
+ },
600
+ {
601
+ "type": "object",
602
+ "properties": {
603
+ "kind": {
604
+ "type": "string",
605
+ "const": "paypal",
606
+ "description": "A PayPal mandate."
607
+ },
608
+ "account": {
609
+ "type": "string",
610
+ "description": "The PayPal account Mollie's mandate names."
611
+ }
612
+ },
613
+ "required": [
614
+ "kind",
615
+ "account"
616
+ ],
617
+ "additionalProperties": false
618
+ }
619
+ ]
620
+ },
621
+ {
622
+ "type": "null"
623
+ }
624
+ ],
625
+ "description": "The payment method on file, or `null`."
626
+ },
627
+ "payment_method_options": {
628
+ "type": "array",
629
+ "items": {
630
+ "type": "object",
631
+ "properties": {
632
+ "method": {
633
+ "type": "string",
634
+ "enum": [
635
+ "card",
636
+ "paypal",
637
+ "applepay"
638
+ ],
639
+ "description": "A method `POST /api/billing/payment-method` accepts now."
640
+ },
641
+ "pays_invoice": {
642
+ "type": "boolean",
643
+ "description": "Whether changing to it also pays the open invoice — `true` only for `applepay` when a zero-amount Apple Pay payment is not available."
644
+ }
645
+ },
646
+ "required": [
647
+ "method",
648
+ "pays_invoice"
649
+ ],
650
+ "additionalProperties": false
651
+ },
652
+ "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."
653
+ },
654
+ "invoices": {
655
+ "type": "array",
656
+ "items": {
657
+ "type": "object",
658
+ "properties": {
659
+ "id": {
660
+ "type": "string",
661
+ "format": "uuid",
662
+ "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)$",
663
+ "description": "The invoice's id."
664
+ },
665
+ "number": {
666
+ "type": "string",
667
+ "pattern": "^FL-\\d{4}-\\d{4,}$",
668
+ "description": "The invoice number: `FL-<year>-<seq>`, `seq` zero-padded to four digits, gapless per calendar year in `Europe/Berlin`."
669
+ },
670
+ "issued_at": {
671
+ "type": "string",
672
+ "format": "date-time",
673
+ "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))$",
674
+ "description": "When the invoice was issued."
675
+ },
676
+ "status": {
677
+ "type": "string",
678
+ "enum": [
679
+ "open",
680
+ "paid",
681
+ "uncollectible"
682
+ ],
683
+ "description": "This invoice's own status."
684
+ },
685
+ "currency": {
686
+ "type": "string",
687
+ "enum": [
688
+ "eur",
689
+ "usd"
690
+ ],
691
+ "description": "The org's billing currency."
692
+ },
693
+ "net_cents": {
694
+ "type": "integer",
695
+ "minimum": 0,
696
+ "maximum": 9007199254740991,
697
+ "description": "The charge, excluding VAT, in integer cents."
698
+ },
699
+ "vat_rate_percent": {
700
+ "type": "integer",
701
+ "minimum": 0,
702
+ "maximum": 100,
703
+ "description": "The VAT rate applied, in whole percent."
704
+ },
705
+ "vat_cents": {
706
+ "type": "integer",
707
+ "minimum": 0,
708
+ "maximum": 9007199254740991,
709
+ "description": "VAT, in integer cents (`vatCents`)."
710
+ },
711
+ "gross_cents": {
712
+ "type": "integer",
713
+ "minimum": 0,
714
+ "maximum": 9007199254740991,
715
+ "description": "Net plus VAT, in integer cents."
716
+ }
717
+ },
718
+ "required": [
719
+ "id",
720
+ "number",
721
+ "issued_at",
722
+ "status",
723
+ "currency",
724
+ "net_cents",
725
+ "vat_rate_percent",
726
+ "vat_cents",
727
+ "gross_cents"
728
+ ],
729
+ "additionalProperties": false
730
+ },
731
+ "description": "Newest first, at most 24."
732
+ }
733
+ },
734
+ "required": [
735
+ "available",
736
+ "account",
737
+ "payment_method",
738
+ "payment_method_options",
739
+ "invoices"
740
+ ],
741
+ "additionalProperties": false,
742
+ "description": "The billing view after the change."
743
+ },
744
+ "charged": {
745
+ "anyOf": [
746
+ {
747
+ "type": "object",
748
+ "properties": {
749
+ "id": {
750
+ "type": "string",
751
+ "format": "uuid",
752
+ "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)$",
753
+ "description": "The invoice's id."
754
+ },
755
+ "number": {
756
+ "type": "string",
757
+ "pattern": "^FL-\\d{4}-\\d{4,}$",
758
+ "description": "The invoice number: `FL-<year>-<seq>`, `seq` zero-padded to four digits, gapless per calendar year in `Europe/Berlin`."
759
+ },
760
+ "issued_at": {
761
+ "type": "string",
762
+ "format": "date-time",
763
+ "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))$",
764
+ "description": "When the invoice was issued."
765
+ },
766
+ "status": {
767
+ "type": "string",
768
+ "enum": [
769
+ "open",
770
+ "paid",
771
+ "uncollectible"
772
+ ],
773
+ "description": "This invoice's own status."
774
+ },
775
+ "currency": {
776
+ "type": "string",
777
+ "enum": [
778
+ "eur",
779
+ "usd"
780
+ ],
781
+ "description": "The org's billing currency."
782
+ },
783
+ "net_cents": {
784
+ "type": "integer",
785
+ "minimum": 0,
786
+ "maximum": 9007199254740991,
787
+ "description": "The charge, excluding VAT, in integer cents."
788
+ },
789
+ "vat_rate_percent": {
790
+ "type": "integer",
791
+ "minimum": 0,
792
+ "maximum": 100,
793
+ "description": "The VAT rate applied, in whole percent."
794
+ },
795
+ "vat_cents": {
796
+ "type": "integer",
797
+ "minimum": 0,
798
+ "maximum": 9007199254740991,
799
+ "description": "VAT, in integer cents (`vatCents`)."
800
+ },
801
+ "gross_cents": {
802
+ "type": "integer",
803
+ "minimum": 0,
804
+ "maximum": 9007199254740991,
805
+ "description": "Net plus VAT, in integer cents."
806
+ }
807
+ },
808
+ "required": [
809
+ "id",
810
+ "number",
811
+ "issued_at",
812
+ "status",
813
+ "currency",
814
+ "net_cents",
815
+ "vat_rate_percent",
816
+ "vat_cents",
817
+ "gross_cents"
818
+ ],
819
+ "additionalProperties": false
820
+ },
821
+ {
822
+ "type": "null"
823
+ }
824
+ ],
825
+ "description": "The invoice charged now, or `null` when the change was only scheduled for the period's end."
826
+ }
827
+ },
828
+ "required": [
829
+ "billing",
830
+ "charged"
831
+ ],
832
+ "additionalProperties": false
833
+ },
834
+ {
835
+ "type": "object",
836
+ "properties": {
837
+ "intent": {
838
+ "oneOf": [
839
+ {
840
+ "type": "object",
841
+ "properties": {
842
+ "intent_id": {
843
+ "type": "string",
844
+ "format": "uuid",
845
+ "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)$",
846
+ "description": "Opaque persisted purchase intent identity."
847
+ },
848
+ "operation_key": {
849
+ "type": "string",
850
+ "format": "uuid",
851
+ "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)$",
852
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
853
+ },
854
+ "operation": {
855
+ "type": "string",
856
+ "enum": [
857
+ "checkout",
858
+ "paid_change",
859
+ "invoice_payment",
860
+ "payment_method_invoice"
861
+ ]
862
+ },
863
+ "invoice_id": {
864
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
865
+ "type": "string",
866
+ "format": "uuid",
867
+ "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)$"
868
+ },
869
+ "state": {
870
+ "type": "string",
871
+ "const": "awaiting_vies"
872
+ },
873
+ "reason": {
874
+ "type": "string",
875
+ "enum": [
876
+ "vies_unavailable",
877
+ "vies_unverified",
878
+ "vies_identifier_missing"
879
+ ]
880
+ },
881
+ "next_attempt_at": {
882
+ "type": "string",
883
+ "format": "date-time",
884
+ "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))$"
885
+ }
886
+ },
887
+ "required": [
888
+ "intent_id",
889
+ "operation_key",
890
+ "operation",
891
+ "state",
892
+ "reason",
893
+ "next_attempt_at"
894
+ ],
895
+ "additionalProperties": false
896
+ },
897
+ {
898
+ "type": "object",
899
+ "properties": {
900
+ "intent_id": {
901
+ "type": "string",
902
+ "format": "uuid",
903
+ "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)$",
904
+ "description": "Opaque persisted purchase intent identity."
905
+ },
906
+ "operation_key": {
907
+ "type": "string",
908
+ "format": "uuid",
909
+ "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)$",
910
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
911
+ },
912
+ "operation": {
913
+ "type": "string",
914
+ "enum": [
915
+ "checkout",
916
+ "paid_change",
917
+ "invoice_payment",
918
+ "payment_method_invoice"
919
+ ]
920
+ },
921
+ "invoice_id": {
922
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
923
+ "type": "string",
924
+ "format": "uuid",
925
+ "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)$"
926
+ },
927
+ "quote_revision": {
928
+ "type": "string",
929
+ "minLength": 1,
930
+ "maxLength": 200,
931
+ "description": "Opaque revision of the displayed quote; echo it when confirming."
932
+ },
933
+ "buyer_fingerprint": {
934
+ "type": "string",
935
+ "minLength": 1,
936
+ "maxLength": 200,
937
+ "description": "Opaque revision of buyer details and email policy; never full VIES evidence."
938
+ },
939
+ "state": {
940
+ "type": "string",
941
+ "const": "eligible"
942
+ },
943
+ "quote": {
944
+ "type": "object",
945
+ "properties": {
946
+ "currency": {
947
+ "type": "string",
948
+ "const": "eur",
949
+ "description": "Every new quote is in EUR."
950
+ },
951
+ "net_cents": {
952
+ "type": "integer",
953
+ "minimum": 0,
954
+ "maximum": 9007199254740991,
955
+ "description": "Current charge excluding VAT, in cents."
956
+ },
957
+ "vat_cents": {
958
+ "type": "integer",
959
+ "minimum": 0,
960
+ "maximum": 9007199254740991,
961
+ "description": "VAT on the current charge, in cents."
962
+ },
963
+ "gross_cents": {
964
+ "type": "integer",
965
+ "minimum": 0,
966
+ "maximum": 9007199254740991,
967
+ "description": "Total to confirm, including VAT, in cents."
968
+ },
969
+ "rate_percent": {
970
+ "type": "integer",
971
+ "minimum": 0,
972
+ "maximum": 100,
973
+ "description": "VAT rate in whole percent."
974
+ }
975
+ },
976
+ "required": [
977
+ "currency",
978
+ "net_cents",
979
+ "vat_cents",
980
+ "gross_cents",
981
+ "rate_percent"
982
+ ],
983
+ "additionalProperties": false
984
+ }
985
+ },
986
+ "required": [
987
+ "intent_id",
988
+ "operation_key",
989
+ "operation",
990
+ "quote_revision",
991
+ "buyer_fingerprint",
992
+ "state",
993
+ "quote"
994
+ ],
995
+ "additionalProperties": false
996
+ },
997
+ {
998
+ "type": "object",
999
+ "properties": {
1000
+ "intent_id": {
1001
+ "type": "string",
1002
+ "format": "uuid",
1003
+ "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)$",
1004
+ "description": "Opaque persisted purchase intent identity."
1005
+ },
1006
+ "operation_key": {
1007
+ "type": "string",
1008
+ "format": "uuid",
1009
+ "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)$",
1010
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
1011
+ },
1012
+ "operation": {
1013
+ "type": "string",
1014
+ "enum": [
1015
+ "checkout",
1016
+ "paid_change",
1017
+ "invoice_payment",
1018
+ "payment_method_invoice",
1019
+ "mandate_setup"
1020
+ ]
1021
+ },
1022
+ "invoice_id": {
1023
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
1024
+ "type": "string",
1025
+ "format": "uuid",
1026
+ "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)$"
1027
+ },
1028
+ "state": {
1029
+ "type": "string",
1030
+ "const": "held"
1031
+ },
1032
+ "reason": {
1033
+ "type": "string",
1034
+ "enum": [
1035
+ "legacy_usd_invoice",
1036
+ "legacy_payer_unresolved",
1037
+ "mandate_policy_unresolved"
1038
+ ]
1039
+ },
1040
+ "original_amount": {
1041
+ "description": "Recorded balance of a held invoice; not a new quote or authorization.",
1042
+ "type": "object",
1043
+ "properties": {
1044
+ "currency": {
508
1045
  "type": "string",
509
- "const": "card",
510
- "description": "A card mandate."
1046
+ "enum": [
1047
+ "eur",
1048
+ "usd"
1049
+ ]
1050
+ },
1051
+ "gross_cents": {
1052
+ "type": "integer",
1053
+ "minimum": 0,
1054
+ "maximum": 9007199254740991
1055
+ }
1056
+ },
1057
+ "required": [
1058
+ "currency",
1059
+ "gross_cents"
1060
+ ],
1061
+ "additionalProperties": false
1062
+ }
1063
+ },
1064
+ "required": [
1065
+ "intent_id",
1066
+ "operation_key",
1067
+ "operation",
1068
+ "state",
1069
+ "reason"
1070
+ ],
1071
+ "additionalProperties": false
1072
+ },
1073
+ {
1074
+ "type": "object",
1075
+ "properties": {
1076
+ "intent_id": {
1077
+ "type": "string",
1078
+ "format": "uuid",
1079
+ "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)$",
1080
+ "description": "Opaque persisted purchase intent identity."
1081
+ },
1082
+ "operation_key": {
1083
+ "type": "string",
1084
+ "format": "uuid",
1085
+ "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)$",
1086
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
1087
+ },
1088
+ "operation": {
1089
+ "type": "string",
1090
+ "enum": [
1091
+ "checkout",
1092
+ "paid_change",
1093
+ "invoice_payment",
1094
+ "payment_method_invoice"
1095
+ ]
1096
+ },
1097
+ "invoice_id": {
1098
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
1099
+ "type": "string",
1100
+ "format": "uuid",
1101
+ "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)$"
1102
+ },
1103
+ "state": {
1104
+ "type": "string",
1105
+ "const": "invalid_vat_id"
1106
+ },
1107
+ "field": {
1108
+ "type": "string",
1109
+ "const": "billing.vat_id"
1110
+ },
1111
+ "rule": {
1112
+ "type": "string",
1113
+ "const": "vat_id_invalid"
1114
+ }
1115
+ },
1116
+ "required": [
1117
+ "intent_id",
1118
+ "operation_key",
1119
+ "operation",
1120
+ "state",
1121
+ "field",
1122
+ "rule"
1123
+ ],
1124
+ "additionalProperties": false
1125
+ },
1126
+ {
1127
+ "type": "object",
1128
+ "properties": {
1129
+ "intent_id": {
1130
+ "type": "string",
1131
+ "format": "uuid",
1132
+ "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)$",
1133
+ "description": "Opaque persisted purchase intent identity."
1134
+ },
1135
+ "operation_key": {
1136
+ "type": "string",
1137
+ "format": "uuid",
1138
+ "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)$",
1139
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
1140
+ },
1141
+ "operation": {
1142
+ "type": "string",
1143
+ "enum": [
1144
+ "checkout",
1145
+ "paid_change",
1146
+ "invoice_payment",
1147
+ "payment_method_invoice"
1148
+ ]
1149
+ },
1150
+ "invoice_id": {
1151
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
1152
+ "type": "string",
1153
+ "format": "uuid",
1154
+ "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)$"
1155
+ },
1156
+ "state": {
1157
+ "type": "string",
1158
+ "const": "refused"
1159
+ },
1160
+ "field": {
1161
+ "type": "string",
1162
+ "minLength": 1
1163
+ },
1164
+ "rule": {
1165
+ "type": "string",
1166
+ "enum": [
1167
+ "company_required",
1168
+ "vat_id_required",
1169
+ "vat_id_invalid",
1170
+ "tax_id_required",
1171
+ "us_state_required",
1172
+ "public_email_domain",
1173
+ "invoice_not_open"
1174
+ ]
1175
+ }
1176
+ },
1177
+ "required": [
1178
+ "intent_id",
1179
+ "operation_key",
1180
+ "operation",
1181
+ "state",
1182
+ "field",
1183
+ "rule"
1184
+ ],
1185
+ "additionalProperties": false
1186
+ },
1187
+ {
1188
+ "type": "object",
1189
+ "properties": {
1190
+ "intent_id": {
1191
+ "type": "string",
1192
+ "format": "uuid",
1193
+ "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)$",
1194
+ "description": "Opaque persisted purchase intent identity."
1195
+ },
1196
+ "operation_key": {
1197
+ "type": "string",
1198
+ "format": "uuid",
1199
+ "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)$",
1200
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
1201
+ },
1202
+ "operation": {
1203
+ "type": "string",
1204
+ "enum": [
1205
+ "checkout",
1206
+ "paid_change",
1207
+ "invoice_payment",
1208
+ "payment_method_invoice"
1209
+ ]
1210
+ },
1211
+ "invoice_id": {
1212
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
1213
+ "type": "string",
1214
+ "format": "uuid",
1215
+ "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)$"
1216
+ },
1217
+ "state": {
1218
+ "type": "string",
1219
+ "const": "payment_started"
1220
+ },
1221
+ "payment_id": {
1222
+ "type": "string",
1223
+ "format": "uuid",
1224
+ "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)$"
1225
+ },
1226
+ "payment": {
1227
+ "oneOf": [
1228
+ {
1229
+ "type": "object",
1230
+ "properties": {
1231
+ "kind": {
1232
+ "type": "string",
1233
+ "const": "hosted"
1234
+ },
1235
+ "checkout_id": {
1236
+ "type": "string",
1237
+ "format": "uuid",
1238
+ "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)$"
1239
+ },
1240
+ "checkout_url": {
1241
+ "type": "string",
1242
+ "format": "uri"
1243
+ }
1244
+ },
1245
+ "required": [
1246
+ "kind",
1247
+ "checkout_id",
1248
+ "checkout_url"
1249
+ ],
1250
+ "additionalProperties": false
1251
+ },
1252
+ {
1253
+ "type": "object",
1254
+ "properties": {
1255
+ "kind": {
1256
+ "type": "string",
1257
+ "const": "mandate"
1258
+ }
1259
+ },
1260
+ "required": [
1261
+ "kind"
1262
+ ],
1263
+ "additionalProperties": false
1264
+ }
1265
+ ]
1266
+ }
1267
+ },
1268
+ "required": [
1269
+ "intent_id",
1270
+ "operation_key",
1271
+ "operation",
1272
+ "state",
1273
+ "payment_id",
1274
+ "payment"
1275
+ ],
1276
+ "additionalProperties": false
1277
+ }
1278
+ ],
1279
+ "allOf": [
1280
+ {
1281
+ "if": {
1282
+ "properties": {
1283
+ "operation": {
1284
+ "enum": [
1285
+ "invoice_payment",
1286
+ "payment_method_invoice"
1287
+ ]
1288
+ }
1289
+ },
1290
+ "required": [
1291
+ "operation"
1292
+ ]
1293
+ },
1294
+ "then": {
1295
+ "required": [
1296
+ "invoice_id"
1297
+ ]
1298
+ }
1299
+ },
1300
+ {
1301
+ "if": {
1302
+ "properties": {
1303
+ "operation": {
1304
+ "const": "mandate_setup"
1305
+ }
1306
+ },
1307
+ "required": [
1308
+ "operation"
1309
+ ]
1310
+ },
1311
+ "then": {
1312
+ "properties": {
1313
+ "state": {
1314
+ "const": "held"
1315
+ },
1316
+ "reason": {
1317
+ "const": "mandate_policy_unresolved"
1318
+ }
1319
+ },
1320
+ "required": [
1321
+ "reason"
1322
+ ]
1323
+ }
1324
+ },
1325
+ {
1326
+ "if": {
1327
+ "properties": {
1328
+ "reason": {
1329
+ "const": "mandate_policy_unresolved"
1330
+ }
1331
+ },
1332
+ "required": [
1333
+ "reason"
1334
+ ]
1335
+ },
1336
+ "then": {
1337
+ "properties": {
1338
+ "operation": {
1339
+ "const": "mandate_setup"
1340
+ }
1341
+ }
1342
+ }
1343
+ },
1344
+ {
1345
+ "if": {
1346
+ "properties": {
1347
+ "payment": {
1348
+ "properties": {
1349
+ "kind": {
1350
+ "const": "mandate"
1351
+ }
1352
+ },
1353
+ "required": [
1354
+ "kind"
1355
+ ]
1356
+ }
1357
+ },
1358
+ "required": [
1359
+ "payment"
1360
+ ]
1361
+ },
1362
+ "then": {
1363
+ "properties": {
1364
+ "operation": {
1365
+ "const": "paid_change"
1366
+ }
1367
+ }
1368
+ }
1369
+ }
1370
+ ]
1371
+ }
1372
+ },
1373
+ "required": [
1374
+ "intent"
1375
+ ],
1376
+ "additionalProperties": false
1377
+ },
1378
+ {
1379
+ "type": "object",
1380
+ "properties": {
1381
+ "billing": {
1382
+ "type": "object",
1383
+ "properties": {
1384
+ "available": {
1385
+ "type": "boolean",
1386
+ "description": "Whether this cloud takes payments at all — `false` when no Mollie key is configured."
1387
+ },
1388
+ "account": {
1389
+ "anyOf": [
1390
+ {
1391
+ "type": "object",
1392
+ "properties": {
1393
+ "payer": {
1394
+ "oneOf": [
1395
+ {
1396
+ "type": "object",
1397
+ "properties": {
1398
+ "kind": {
1399
+ "type": "string",
1400
+ "const": "company",
1401
+ "description": "Billed as a company."
1402
+ },
1403
+ "company_name": {
1404
+ "type": "string",
1405
+ "minLength": 1,
1406
+ "maxLength": 200,
1407
+ "description": "The company's legal name, printed on the invoice."
1408
+ },
1409
+ "vat_id": {
1410
+ "anyOf": [
1411
+ {
1412
+ "type": "string",
1413
+ "maxLength": 20
1414
+ },
1415
+ {
1416
+ "type": "null"
1417
+ }
1418
+ ],
1419
+ "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."
1420
+ },
1421
+ "tax_id": {
1422
+ "description": "Free-text Tax ID. Required for a new non-EU purchase; historical records may omit it.",
1423
+ "anyOf": [
1424
+ {
1425
+ "type": "string",
1426
+ "maxLength": 100
1427
+ },
1428
+ {
1429
+ "type": "null"
1430
+ }
1431
+ ]
1432
+ },
1433
+ "address": {
1434
+ "type": "object",
1435
+ "properties": {
1436
+ "line1": {
1437
+ "type": "string",
1438
+ "minLength": 1,
1439
+ "maxLength": 200,
1440
+ "description": "Street and number, or the first address line."
1441
+ },
1442
+ "line2": {
1443
+ "anyOf": [
1444
+ {
1445
+ "type": "string",
1446
+ "maxLength": 200
1447
+ },
1448
+ {
1449
+ "type": "null"
1450
+ }
1451
+ ],
1452
+ "description": "A second address line, or `null` when there is none."
1453
+ },
1454
+ "postal_code": {
1455
+ "type": "string",
1456
+ "minLength": 1,
1457
+ "maxLength": 20,
1458
+ "description": "Postal or ZIP code."
1459
+ },
1460
+ "city": {
1461
+ "type": "string",
1462
+ "minLength": 1,
1463
+ "maxLength": 100,
1464
+ "description": "City or town."
1465
+ },
1466
+ "country": {
1467
+ "type": "string",
1468
+ "pattern": "^[A-Z]{2}$",
1469
+ "description": "The billing country, used for purchase eligibility and VAT."
1470
+ },
1471
+ "state": {
1472
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
1473
+ "type": "string",
1474
+ "minLength": 1,
1475
+ "maxLength": 100
1476
+ }
1477
+ },
1478
+ "required": [
1479
+ "line1",
1480
+ "line2",
1481
+ "postal_code",
1482
+ "city",
1483
+ "country"
1484
+ ],
1485
+ "additionalProperties": false,
1486
+ "description": "The billing address."
1487
+ },
1488
+ "invoice_email": {
1489
+ "type": "string",
1490
+ "format": "email",
1491
+ "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
1492
+ "description": "Where invoices and billing mail are sent."
1493
+ }
1494
+ },
1495
+ "required": [
1496
+ "kind",
1497
+ "company_name",
1498
+ "vat_id",
1499
+ "address",
1500
+ "invoice_email"
1501
+ ],
1502
+ "additionalProperties": false,
1503
+ "description": "A company: name and an optional VAT ID, never 'full name'."
1504
+ },
1505
+ {
1506
+ "type": "object",
1507
+ "properties": {
1508
+ "kind": {
1509
+ "type": "string",
1510
+ "const": "person",
1511
+ "description": "Billed as a person."
1512
+ },
1513
+ "full_name": {
1514
+ "type": "string",
1515
+ "minLength": 1,
1516
+ "maxLength": 200,
1517
+ "description": "The person's full name, printed on the invoice."
1518
+ },
1519
+ "address": {
1520
+ "type": "object",
1521
+ "properties": {
1522
+ "line1": {
1523
+ "type": "string",
1524
+ "minLength": 1,
1525
+ "maxLength": 200,
1526
+ "description": "Street and number, or the first address line."
1527
+ },
1528
+ "line2": {
1529
+ "anyOf": [
1530
+ {
1531
+ "type": "string",
1532
+ "maxLength": 200
1533
+ },
1534
+ {
1535
+ "type": "null"
1536
+ }
1537
+ ],
1538
+ "description": "A second address line, or `null` when there is none."
1539
+ },
1540
+ "postal_code": {
1541
+ "type": "string",
1542
+ "minLength": 1,
1543
+ "maxLength": 20,
1544
+ "description": "Postal or ZIP code."
1545
+ },
1546
+ "city": {
1547
+ "type": "string",
1548
+ "minLength": 1,
1549
+ "maxLength": 100,
1550
+ "description": "City or town."
1551
+ },
1552
+ "country": {
1553
+ "type": "string",
1554
+ "pattern": "^[A-Z]{2}$",
1555
+ "description": "The billing country, used for purchase eligibility and VAT."
1556
+ },
1557
+ "state": {
1558
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
1559
+ "type": "string",
1560
+ "minLength": 1,
1561
+ "maxLength": 100
1562
+ }
1563
+ },
1564
+ "required": [
1565
+ "line1",
1566
+ "line2",
1567
+ "postal_code",
1568
+ "city",
1569
+ "country"
1570
+ ],
1571
+ "additionalProperties": false,
1572
+ "description": "The billing address."
1573
+ },
1574
+ "invoice_email": {
1575
+ "type": "string",
1576
+ "format": "email",
1577
+ "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
1578
+ "description": "Where invoices and billing mail are sent."
1579
+ }
1580
+ },
1581
+ "required": [
1582
+ "kind",
1583
+ "full_name",
1584
+ "address",
1585
+ "invoice_email"
1586
+ ],
1587
+ "additionalProperties": false,
1588
+ "description": "A person: a full name, never a VAT ID — only a company can be VAT-registered."
1589
+ }
1590
+ ],
1591
+ "description": "Who is paying, and the invoice address and email."
1592
+ },
1593
+ "vat_id_status": {
1594
+ "anyOf": [
1595
+ {
1596
+ "type": "string",
1597
+ "enum": [
1598
+ "valid",
1599
+ "unverified",
1600
+ "invalid",
1601
+ "unavailable"
1602
+ ]
1603
+ },
1604
+ {
1605
+ "type": "null"
1606
+ }
1607
+ ],
1608
+ "description": "The payer's VAT ID check, or `null` when no VAT ID was given."
1609
+ },
1610
+ "vat": {
1611
+ "anyOf": [
1612
+ {
1613
+ "type": "object",
1614
+ "properties": {
1615
+ "treatment": {
1616
+ "type": "string",
1617
+ "enum": [
1618
+ "de_standard",
1619
+ "reverse_charge",
1620
+ "outside_eu"
1621
+ ],
1622
+ "description": "How the account is taxed."
1623
+ },
1624
+ "rate_percent": {
1625
+ "type": "integer",
1626
+ "minimum": -9007199254740991,
1627
+ "maximum": 9007199254740991,
1628
+ "description": "The VAT rate, in whole percent."
1629
+ }
1630
+ },
1631
+ "required": [
1632
+ "treatment",
1633
+ "rate_percent"
1634
+ ],
1635
+ "additionalProperties": false
1636
+ },
1637
+ {
1638
+ "type": "null"
1639
+ }
1640
+ ],
1641
+ "description": "Recorded VAT treatment; null while the current buyer has no eligible decision. Never infer zero rating from a pending account."
511
1642
  },
512
- "brand": {
1643
+ "currency": {
513
1644
  "type": "string",
514
- "description": "The card network, as Mollie's mandate reports it, e.g. 'Visa'."
1645
+ "enum": [
1646
+ "eur",
1647
+ "usd"
1648
+ ],
1649
+ "description": "The org's billing currency, fixed at the first payment."
515
1650
  },
516
- "last4": {
1651
+ "cycle": {
517
1652
  "type": "string",
518
- "pattern": "^\\d{4}$",
519
- "description": "The last four digits of the card."
1653
+ "enum": [
1654
+ "monthly",
1655
+ "yearly"
1656
+ ],
1657
+ "description": "The current billing cycle."
520
1658
  },
521
- "expires": {
1659
+ "status": {
522
1660
  "type": "string",
523
- "pattern": "^\\d{2}\\/\\d{2}$",
524
- "description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
1661
+ "enum": [
1662
+ "pending",
1663
+ "active",
1664
+ "past_due",
1665
+ "canceled"
1666
+ ],
1667
+ "description": "The account's own status."
1668
+ },
1669
+ "period_starts_at": {
1670
+ "anyOf": [
1671
+ {
1672
+ "type": "string",
1673
+ "format": "date-time",
1674
+ "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))$"
1675
+ },
1676
+ {
1677
+ "type": "null"
1678
+ }
1679
+ ],
1680
+ "description": "The current period's start. `null` before the first payment."
1681
+ },
1682
+ "period_ends_at": {
1683
+ "anyOf": [
1684
+ {
1685
+ "type": "string",
1686
+ "format": "date-time",
1687
+ "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))$"
1688
+ },
1689
+ {
1690
+ "type": "null"
1691
+ }
1692
+ ],
1693
+ "description": "The current period's end. `null` before the first payment."
1694
+ },
1695
+ "next_charge": {
1696
+ "anyOf": [
1697
+ {
1698
+ "type": "object",
1699
+ "properties": {
1700
+ "at": {
1701
+ "type": "string",
1702
+ "format": "date-time",
1703
+ "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))$",
1704
+ "description": "When the next charge is due."
1705
+ },
1706
+ "net_cents": {
1707
+ "type": "integer",
1708
+ "minimum": -9007199254740991,
1709
+ "maximum": 9007199254740991,
1710
+ "description": "The next charge, excluding VAT, in integer cents."
1711
+ },
1712
+ "vat_cents": {
1713
+ "type": "integer",
1714
+ "minimum": -9007199254740991,
1715
+ "maximum": 9007199254740991,
1716
+ "description": "VAT on the next charge, in integer cents."
1717
+ },
1718
+ "gross_cents": {
1719
+ "type": "integer",
1720
+ "minimum": -9007199254740991,
1721
+ "maximum": 9007199254740991,
1722
+ "description": "The next charge including VAT, in integer cents."
1723
+ }
1724
+ },
1725
+ "required": [
1726
+ "at",
1727
+ "net_cents",
1728
+ "vat_cents",
1729
+ "gross_cents"
1730
+ ],
1731
+ "additionalProperties": false
1732
+ },
1733
+ {
1734
+ "type": "null"
1735
+ }
1736
+ ],
1737
+ "description": "`null` while a cancel is pending or nothing else renews."
1738
+ },
1739
+ "scheduled": {
1740
+ "type": "object",
1741
+ "properties": {
1742
+ "cycle": {
1743
+ "anyOf": [
1744
+ {
1745
+ "type": "string",
1746
+ "enum": [
1747
+ "monthly",
1748
+ "yearly"
1749
+ ]
1750
+ },
1751
+ {
1752
+ "type": "null"
1753
+ }
1754
+ ],
1755
+ "description": "A cycle change queued for the period's end, or `null`."
1756
+ },
1757
+ "addons": {
1758
+ "anyOf": [
1759
+ {
1760
+ "type": "object",
1761
+ "properties": {
1762
+ "seats": {
1763
+ "type": "integer",
1764
+ "minimum": 0,
1765
+ "maximum": 9007199254740991,
1766
+ "description": "Extra developer seats, one each."
1767
+ },
1768
+ "robots": {
1769
+ "type": "integer",
1770
+ "minimum": 0,
1771
+ "maximum": 9007199254740991,
1772
+ "description": "Extra robots, one each."
1773
+ },
1774
+ "apps": {
1775
+ "type": "integer",
1776
+ "minimum": 0,
1777
+ "maximum": 9007199254740991,
1778
+ "description": "Extra apps, one each."
1779
+ },
1780
+ "app_user_packs": {
1781
+ "type": "integer",
1782
+ "minimum": 0,
1783
+ "maximum": 9007199254740991,
1784
+ "description": "Packs of five extra app users."
1785
+ },
1786
+ "live_video_packs": {
1787
+ "type": "integer",
1788
+ "minimum": 0,
1789
+ "maximum": 9007199254740991,
1790
+ "description": "Packs of 250 extra hours of app-user live video per month."
1791
+ }
1792
+ },
1793
+ "required": [
1794
+ "seats",
1795
+ "robots",
1796
+ "apps",
1797
+ "app_user_packs",
1798
+ "live_video_packs"
1799
+ ],
1800
+ "additionalProperties": false
1801
+ },
1802
+ {
1803
+ "type": "null"
1804
+ }
1805
+ ],
1806
+ "description": "Add-on counts queued for the period's end, or `null`."
1807
+ }
1808
+ },
1809
+ "required": [
1810
+ "cycle",
1811
+ "addons"
1812
+ ],
1813
+ "additionalProperties": false,
1814
+ "description": "What takes effect at the period's end."
1815
+ },
1816
+ "dunning": {
1817
+ "anyOf": [
1818
+ {
1819
+ "type": "object",
1820
+ "properties": {
1821
+ "invoice_id": {
1822
+ "type": "string",
1823
+ "format": "uuid",
1824
+ "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)$",
1825
+ "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."
1826
+ },
1827
+ "gross_cents": {
1828
+ "type": "integer",
1829
+ "minimum": -9007199254740991,
1830
+ "maximum": 9007199254740991,
1831
+ "description": "The amount owed, in integer cents — after a partial chargeback only the charged-back part."
1832
+ },
1833
+ "due_at": {
1834
+ "type": "string",
1835
+ "format": "date-time",
1836
+ "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))$",
1837
+ "description": "The charge's due date; retries and the lock count from here."
1838
+ },
1839
+ "next_retry_at": {
1840
+ "anyOf": [
1841
+ {
1842
+ "type": "string",
1843
+ "format": "date-time",
1844
+ "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))$"
1845
+ },
1846
+ {
1847
+ "type": "null"
1848
+ }
1849
+ ],
1850
+ "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."
1851
+ },
1852
+ "lock_at": {
1853
+ "type": "string",
1854
+ "format": "date-time",
1855
+ "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))$",
1856
+ "description": "When the org is locked if still unpaid (`BILLING_LOCK_DAY`)."
1857
+ },
1858
+ "failure": {
1859
+ "anyOf": [
1860
+ {
1861
+ "type": "string"
1862
+ },
1863
+ {
1864
+ "type": "null"
1865
+ }
1866
+ ],
1867
+ "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."
1868
+ }
1869
+ },
1870
+ "required": [
1871
+ "invoice_id",
1872
+ "gross_cents",
1873
+ "due_at",
1874
+ "next_retry_at",
1875
+ "lock_at",
1876
+ "failure"
1877
+ ],
1878
+ "additionalProperties": false
1879
+ },
1880
+ {
1881
+ "type": "null"
1882
+ }
1883
+ ],
1884
+ "description": "`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced."
525
1885
  }
526
1886
  },
527
1887
  "required": [
528
- "kind",
529
- "brand",
530
- "last4",
531
- "expires"
1888
+ "payer",
1889
+ "vat_id_status",
1890
+ "vat",
1891
+ "currency",
1892
+ "cycle",
1893
+ "status",
1894
+ "period_starts_at",
1895
+ "period_ends_at",
1896
+ "next_charge",
1897
+ "scheduled",
1898
+ "dunning"
532
1899
  ],
533
1900
  "additionalProperties": false
534
1901
  },
1902
+ {
1903
+ "type": "null"
1904
+ }
1905
+ ],
1906
+ "description": "`null` before the org has ever checked out."
1907
+ },
1908
+ "payment_method": {
1909
+ "anyOf": [
1910
+ {
1911
+ "oneOf": [
1912
+ {
1913
+ "type": "object",
1914
+ "properties": {
1915
+ "kind": {
1916
+ "type": "string",
1917
+ "const": "card",
1918
+ "description": "A card mandate."
1919
+ },
1920
+ "brand": {
1921
+ "type": "string",
1922
+ "description": "The card network, as Mollie's mandate reports it, e.g. 'Visa'."
1923
+ },
1924
+ "last4": {
1925
+ "type": "string",
1926
+ "pattern": "^\\d{4}$",
1927
+ "description": "The last four digits of the card."
1928
+ },
1929
+ "expires": {
1930
+ "type": "string",
1931
+ "pattern": "^\\d{2}\\/\\d{2}$",
1932
+ "description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
1933
+ }
1934
+ },
1935
+ "required": [
1936
+ "kind",
1937
+ "brand",
1938
+ "last4",
1939
+ "expires"
1940
+ ],
1941
+ "additionalProperties": false
1942
+ },
1943
+ {
1944
+ "type": "object",
1945
+ "properties": {
1946
+ "kind": {
1947
+ "type": "string",
1948
+ "const": "applepay",
1949
+ "description": "A card mandate from an Apple Pay first payment — Mollie stores it as `creditcard`; Fleetless labels it Apple Pay."
1950
+ },
1951
+ "brand": {
1952
+ "type": "string",
1953
+ "description": "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'."
1954
+ },
1955
+ "last4": {
1956
+ "type": "string",
1957
+ "pattern": "^\\d{4}$",
1958
+ "description": "The last four digits of the card behind Apple Pay."
1959
+ },
1960
+ "expires": {
1961
+ "type": "string",
1962
+ "pattern": "^\\d{2}\\/\\d{2}$",
1963
+ "description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
1964
+ }
1965
+ },
1966
+ "required": [
1967
+ "kind",
1968
+ "brand",
1969
+ "last4",
1970
+ "expires"
1971
+ ],
1972
+ "additionalProperties": false
1973
+ },
1974
+ {
1975
+ "type": "object",
1976
+ "properties": {
1977
+ "kind": {
1978
+ "type": "string",
1979
+ "const": "paypal",
1980
+ "description": "A PayPal mandate."
1981
+ },
1982
+ "account": {
1983
+ "type": "string",
1984
+ "description": "The PayPal account Mollie's mandate names."
1985
+ }
1986
+ },
1987
+ "required": [
1988
+ "kind",
1989
+ "account"
1990
+ ],
1991
+ "additionalProperties": false
1992
+ }
1993
+ ]
1994
+ },
1995
+ {
1996
+ "type": "null"
1997
+ }
1998
+ ],
1999
+ "description": "The payment method on file, or `null`."
2000
+ },
2001
+ "payment_method_options": {
2002
+ "type": "array",
2003
+ "items": {
2004
+ "type": "object",
2005
+ "properties": {
2006
+ "method": {
2007
+ "type": "string",
2008
+ "enum": [
2009
+ "card",
2010
+ "paypal",
2011
+ "applepay"
2012
+ ],
2013
+ "description": "A method `POST /api/billing/payment-method` accepts now."
2014
+ },
2015
+ "pays_invoice": {
2016
+ "type": "boolean",
2017
+ "description": "Whether changing to it also pays the open invoice — `true` only for `applepay` when a zero-amount Apple Pay payment is not available."
2018
+ }
2019
+ },
2020
+ "required": [
2021
+ "method",
2022
+ "pays_invoice"
2023
+ ],
2024
+ "additionalProperties": false
2025
+ },
2026
+ "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."
2027
+ },
2028
+ "invoices": {
2029
+ "type": "array",
2030
+ "items": {
2031
+ "type": "object",
2032
+ "properties": {
2033
+ "id": {
2034
+ "type": "string",
2035
+ "format": "uuid",
2036
+ "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)$",
2037
+ "description": "The invoice's id."
2038
+ },
2039
+ "number": {
2040
+ "type": "string",
2041
+ "pattern": "^FL-\\d{4}-\\d{4,}$",
2042
+ "description": "The invoice number: `FL-<year>-<seq>`, `seq` zero-padded to four digits, gapless per calendar year in `Europe/Berlin`."
2043
+ },
2044
+ "issued_at": {
2045
+ "type": "string",
2046
+ "format": "date-time",
2047
+ "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))$",
2048
+ "description": "When the invoice was issued."
2049
+ },
2050
+ "status": {
2051
+ "type": "string",
2052
+ "enum": [
2053
+ "open",
2054
+ "paid",
2055
+ "uncollectible"
2056
+ ],
2057
+ "description": "This invoice's own status."
2058
+ },
2059
+ "currency": {
2060
+ "type": "string",
2061
+ "enum": [
2062
+ "eur",
2063
+ "usd"
2064
+ ],
2065
+ "description": "The org's billing currency."
2066
+ },
2067
+ "net_cents": {
2068
+ "type": "integer",
2069
+ "minimum": 0,
2070
+ "maximum": 9007199254740991,
2071
+ "description": "The charge, excluding VAT, in integer cents."
2072
+ },
2073
+ "vat_rate_percent": {
2074
+ "type": "integer",
2075
+ "minimum": 0,
2076
+ "maximum": 100,
2077
+ "description": "The VAT rate applied, in whole percent."
2078
+ },
2079
+ "vat_cents": {
2080
+ "type": "integer",
2081
+ "minimum": 0,
2082
+ "maximum": 9007199254740991,
2083
+ "description": "VAT, in integer cents (`vatCents`)."
2084
+ },
2085
+ "gross_cents": {
2086
+ "type": "integer",
2087
+ "minimum": 0,
2088
+ "maximum": 9007199254740991,
2089
+ "description": "Net plus VAT, in integer cents."
2090
+ }
2091
+ },
2092
+ "required": [
2093
+ "id",
2094
+ "number",
2095
+ "issued_at",
2096
+ "status",
2097
+ "currency",
2098
+ "net_cents",
2099
+ "vat_rate_percent",
2100
+ "vat_cents",
2101
+ "gross_cents"
2102
+ ],
2103
+ "additionalProperties": false
2104
+ },
2105
+ "description": "Newest first, at most 24."
2106
+ }
2107
+ },
2108
+ "required": [
2109
+ "available",
2110
+ "account",
2111
+ "payment_method",
2112
+ "payment_method_options",
2113
+ "invoices"
2114
+ ],
2115
+ "additionalProperties": false,
2116
+ "description": "The billing view after the change."
2117
+ },
2118
+ "charged": {
2119
+ "anyOf": [
2120
+ {
2121
+ "type": "object",
2122
+ "properties": {
2123
+ "id": {
2124
+ "type": "string",
2125
+ "format": "uuid",
2126
+ "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)$",
2127
+ "description": "The invoice's id."
2128
+ },
2129
+ "number": {
2130
+ "type": "string",
2131
+ "pattern": "^FL-\\d{4}-\\d{4,}$",
2132
+ "description": "The invoice number: `FL-<year>-<seq>`, `seq` zero-padded to four digits, gapless per calendar year in `Europe/Berlin`."
2133
+ },
2134
+ "issued_at": {
2135
+ "type": "string",
2136
+ "format": "date-time",
2137
+ "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))$",
2138
+ "description": "When the invoice was issued."
2139
+ },
2140
+ "status": {
2141
+ "type": "string",
2142
+ "enum": [
2143
+ "open",
2144
+ "paid",
2145
+ "uncollectible"
2146
+ ],
2147
+ "description": "This invoice's own status."
2148
+ },
2149
+ "currency": {
2150
+ "type": "string",
2151
+ "enum": [
2152
+ "eur",
2153
+ "usd"
2154
+ ],
2155
+ "description": "The org's billing currency."
2156
+ },
2157
+ "net_cents": {
2158
+ "type": "integer",
2159
+ "minimum": 0,
2160
+ "maximum": 9007199254740991,
2161
+ "description": "The charge, excluding VAT, in integer cents."
2162
+ },
2163
+ "vat_rate_percent": {
2164
+ "type": "integer",
2165
+ "minimum": 0,
2166
+ "maximum": 100,
2167
+ "description": "The VAT rate applied, in whole percent."
2168
+ },
2169
+ "vat_cents": {
2170
+ "type": "integer",
2171
+ "minimum": 0,
2172
+ "maximum": 9007199254740991,
2173
+ "description": "VAT, in integer cents (`vatCents`)."
2174
+ },
2175
+ "gross_cents": {
2176
+ "type": "integer",
2177
+ "minimum": 0,
2178
+ "maximum": 9007199254740991,
2179
+ "description": "Net plus VAT, in integer cents."
2180
+ }
2181
+ },
2182
+ "required": [
2183
+ "id",
2184
+ "number",
2185
+ "issued_at",
2186
+ "status",
2187
+ "currency",
2188
+ "net_cents",
2189
+ "vat_rate_percent",
2190
+ "vat_cents",
2191
+ "gross_cents"
2192
+ ],
2193
+ "additionalProperties": false
2194
+ },
2195
+ {
2196
+ "type": "null"
2197
+ }
2198
+ ],
2199
+ "description": "The invoice charged now, or `null` when the change was only scheduled for the period's end."
2200
+ },
2201
+ "intent": {
2202
+ "type": "object",
2203
+ "properties": {
2204
+ "intent_id": {
2205
+ "type": "string",
2206
+ "format": "uuid",
2207
+ "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)$",
2208
+ "description": "Opaque persisted purchase intent identity."
2209
+ },
2210
+ "operation_key": {
2211
+ "type": "string",
2212
+ "format": "uuid",
2213
+ "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)$",
2214
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
2215
+ },
2216
+ "operation": {
2217
+ "type": "string",
2218
+ "enum": [
2219
+ "checkout",
2220
+ "paid_change",
2221
+ "invoice_payment",
2222
+ "payment_method_invoice"
2223
+ ]
2224
+ },
2225
+ "invoice_id": {
2226
+ "description": "The due charge or issued invoice, for invoice-paying operations.",
2227
+ "type": "string",
2228
+ "format": "uuid",
2229
+ "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)$"
2230
+ },
2231
+ "state": {
2232
+ "type": "string",
2233
+ "const": "payment_started"
2234
+ },
2235
+ "payment_id": {
2236
+ "type": "string",
2237
+ "format": "uuid",
2238
+ "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)$"
2239
+ },
2240
+ "payment": {
2241
+ "oneOf": [
535
2242
  {
536
2243
  "type": "object",
537
2244
  "properties": {
538
2245
  "kind": {
539
2246
  "type": "string",
540
- "const": "applepay",
541
- "description": "A card mandate from an Apple Pay first payment — Mollie stores it as `creditcard`; Fleetless labels it Apple Pay."
542
- },
543
- "brand": {
544
- "type": "string",
545
- "description": "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'."
2247
+ "const": "hosted"
546
2248
  },
547
- "last4": {
2249
+ "checkout_id": {
548
2250
  "type": "string",
549
- "pattern": "^\\d{4}$",
550
- "description": "The last four digits of the card behind Apple Pay."
2251
+ "format": "uuid",
2252
+ "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)$"
551
2253
  },
552
- "expires": {
2254
+ "checkout_url": {
553
2255
  "type": "string",
554
- "pattern": "^\\d{2}\\/\\d{2}$",
555
- "description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
2256
+ "format": "uri"
556
2257
  }
557
2258
  },
558
2259
  "required": [
559
2260
  "kind",
560
- "brand",
561
- "last4",
562
- "expires"
2261
+ "checkout_id",
2262
+ "checkout_url"
563
2263
  ],
564
2264
  "additionalProperties": false
565
2265
  },
@@ -568,232 +2268,126 @@
568
2268
  "properties": {
569
2269
  "kind": {
570
2270
  "type": "string",
571
- "const": "paypal",
572
- "description": "A PayPal mandate."
573
- },
574
- "account": {
575
- "type": "string",
576
- "description": "The PayPal account Mollie's mandate names."
2271
+ "const": "mandate"
577
2272
  }
578
2273
  },
579
2274
  "required": [
580
- "kind",
581
- "account"
2275
+ "kind"
582
2276
  ],
583
2277
  "additionalProperties": false
584
2278
  }
585
2279
  ]
586
- },
587
- {
588
- "type": "null"
589
2280
  }
2281
+ },
2282
+ "required": [
2283
+ "intent_id",
2284
+ "operation_key",
2285
+ "operation",
2286
+ "state",
2287
+ "payment_id",
2288
+ "payment"
590
2289
  ],
591
- "description": "The payment method on file, or `null`."
592
- },
593
- "payment_method_options": {
594
- "type": "array",
595
- "items": {
596
- "type": "object",
597
- "properties": {
598
- "method": {
599
- "type": "string",
600
- "enum": [
601
- "card",
602
- "paypal",
603
- "applepay"
604
- ],
605
- "description": "A method `POST /api/billing/payment-method` accepts now."
2290
+ "additionalProperties": false,
2291
+ "allOf": [
2292
+ {
2293
+ "if": {
2294
+ "properties": {
2295
+ "operation": {
2296
+ "enum": [
2297
+ "invoice_payment",
2298
+ "payment_method_invoice"
2299
+ ]
2300
+ }
2301
+ },
2302
+ "required": [
2303
+ "operation"
2304
+ ]
606
2305
  },
607
- "pays_invoice": {
608
- "type": "boolean",
609
- "description": "Whether changing to it also pays the open invoice — `true` only for `applepay` when a zero-amount Apple Pay payment is not available."
2306
+ "then": {
2307
+ "required": [
2308
+ "invoice_id"
2309
+ ]
610
2310
  }
611
2311
  },
612
- "required": [
613
- "method",
614
- "pays_invoice"
615
- ],
616
- "additionalProperties": false
617
- },
618
- "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."
619
- },
620
- "invoices": {
621
- "type": "array",
622
- "items": {
623
- "type": "object",
624
- "properties": {
625
- "id": {
626
- "type": "string",
627
- "format": "uuid",
628
- "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)$",
629
- "description": "The invoice's id."
630
- },
631
- "number": {
632
- "type": "string",
633
- "pattern": "^FL-\\d{4}-\\d{4,}$",
634
- "description": "The invoice number: `FL-<year>-<seq>`, `seq` zero-padded to four digits, gapless per calendar year in `Europe/Berlin`."
635
- },
636
- "issued_at": {
637
- "type": "string",
638
- "format": "date-time",
639
- "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))$",
640
- "description": "When the invoice was issued."
641
- },
642
- "status": {
643
- "type": "string",
644
- "enum": [
645
- "open",
646
- "paid",
647
- "uncollectible"
648
- ],
649
- "description": "This invoice's own status."
650
- },
651
- "currency": {
652
- "type": "string",
653
- "enum": [
654
- "eur",
655
- "usd"
656
- ],
657
- "description": "The org's billing currency."
658
- },
659
- "net_cents": {
660
- "type": "integer",
661
- "minimum": 0,
662
- "maximum": 9007199254740991,
663
- "description": "The charge, excluding VAT, in integer cents."
664
- },
665
- "vat_rate_percent": {
666
- "type": "integer",
667
- "minimum": 0,
668
- "maximum": 100,
669
- "description": "The VAT rate applied, in whole percent."
2312
+ {
2313
+ "if": {
2314
+ "properties": {
2315
+ "operation": {
2316
+ "const": "mandate_setup"
2317
+ }
2318
+ },
2319
+ "required": [
2320
+ "operation"
2321
+ ]
670
2322
  },
671
- "vat_cents": {
672
- "type": "integer",
673
- "minimum": 0,
674
- "maximum": 9007199254740991,
675
- "description": "VAT, in integer cents (`vatCents`)."
2323
+ "then": {
2324
+ "properties": {
2325
+ "state": {
2326
+ "const": "held"
2327
+ },
2328
+ "reason": {
2329
+ "const": "mandate_policy_unresolved"
2330
+ }
2331
+ },
2332
+ "required": [
2333
+ "reason"
2334
+ ]
2335
+ }
2336
+ },
2337
+ {
2338
+ "if": {
2339
+ "properties": {
2340
+ "reason": {
2341
+ "const": "mandate_policy_unresolved"
2342
+ }
2343
+ },
2344
+ "required": [
2345
+ "reason"
2346
+ ]
676
2347
  },
677
- "gross_cents": {
678
- "type": "integer",
679
- "minimum": 0,
680
- "maximum": 9007199254740991,
681
- "description": "Net plus VAT, in integer cents."
2348
+ "then": {
2349
+ "properties": {
2350
+ "operation": {
2351
+ "const": "mandate_setup"
2352
+ }
2353
+ }
682
2354
  }
683
2355
  },
684
- "required": [
685
- "id",
686
- "number",
687
- "issued_at",
688
- "status",
689
- "currency",
690
- "net_cents",
691
- "vat_rate_percent",
692
- "vat_cents",
693
- "gross_cents"
694
- ],
695
- "additionalProperties": false
696
- },
697
- "description": "Newest first, at most 24."
2356
+ {
2357
+ "if": {
2358
+ "properties": {
2359
+ "payment": {
2360
+ "properties": {
2361
+ "kind": {
2362
+ "const": "mandate"
2363
+ }
2364
+ },
2365
+ "required": [
2366
+ "kind"
2367
+ ]
2368
+ }
2369
+ },
2370
+ "required": [
2371
+ "payment"
2372
+ ]
2373
+ },
2374
+ "then": {
2375
+ "properties": {
2376
+ "operation": {
2377
+ "const": "paid_change"
2378
+ }
2379
+ }
2380
+ }
2381
+ }
2382
+ ]
698
2383
  }
699
2384
  },
700
2385
  "required": [
701
- "available",
702
- "account",
703
- "payment_method",
704
- "payment_method_options",
705
- "invoices"
706
- ],
707
- "additionalProperties": false,
708
- "description": "The billing view after the change."
709
- },
710
- "charged": {
711
- "anyOf": [
712
- {
713
- "type": "object",
714
- "properties": {
715
- "id": {
716
- "type": "string",
717
- "format": "uuid",
718
- "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)$",
719
- "description": "The invoice's id."
720
- },
721
- "number": {
722
- "type": "string",
723
- "pattern": "^FL-\\d{4}-\\d{4,}$",
724
- "description": "The invoice number: `FL-<year>-<seq>`, `seq` zero-padded to four digits, gapless per calendar year in `Europe/Berlin`."
725
- },
726
- "issued_at": {
727
- "type": "string",
728
- "format": "date-time",
729
- "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))$",
730
- "description": "When the invoice was issued."
731
- },
732
- "status": {
733
- "type": "string",
734
- "enum": [
735
- "open",
736
- "paid",
737
- "uncollectible"
738
- ],
739
- "description": "This invoice's own status."
740
- },
741
- "currency": {
742
- "type": "string",
743
- "enum": [
744
- "eur",
745
- "usd"
746
- ],
747
- "description": "The org's billing currency."
748
- },
749
- "net_cents": {
750
- "type": "integer",
751
- "minimum": 0,
752
- "maximum": 9007199254740991,
753
- "description": "The charge, excluding VAT, in integer cents."
754
- },
755
- "vat_rate_percent": {
756
- "type": "integer",
757
- "minimum": 0,
758
- "maximum": 100,
759
- "description": "The VAT rate applied, in whole percent."
760
- },
761
- "vat_cents": {
762
- "type": "integer",
763
- "minimum": 0,
764
- "maximum": 9007199254740991,
765
- "description": "VAT, in integer cents (`vatCents`)."
766
- },
767
- "gross_cents": {
768
- "type": "integer",
769
- "minimum": 0,
770
- "maximum": 9007199254740991,
771
- "description": "Net plus VAT, in integer cents."
772
- }
773
- },
774
- "required": [
775
- "id",
776
- "number",
777
- "issued_at",
778
- "status",
779
- "currency",
780
- "net_cents",
781
- "vat_rate_percent",
782
- "vat_cents",
783
- "gross_cents"
784
- ],
785
- "additionalProperties": false
786
- },
787
- {
788
- "type": "null"
789
- }
2386
+ "billing",
2387
+ "charged",
2388
+ "intent"
790
2389
  ],
791
- "description": "The invoice charged now, or `null` when the change was only scheduled for the period's end."
2390
+ "additionalProperties": false
792
2391
  }
793
- },
794
- "required": [
795
- "billing",
796
- "charged"
797
- ],
798
- "additionalProperties": false
2392
+ ]
799
2393
  }