@fleetless/contracts 6.3.0-next.3 → 6.3.0-next.4

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.
package/CHANGELOG.md CHANGED
@@ -36,6 +36,13 @@ version.
36
36
  to Apple Pay may be refused with `400 validation_error`, rule
37
37
  `applepay_needs_open_invoice`, where it can only be made while paying an
38
38
  open invoice; `payment_method_options` says which applies.
39
+ - **The VAT-ID hold and chargebacks** (descriptions only). A renewal held
40
+ by the VAT ID is a due charge without an invoice number until it is
41
+ paid: `dunning.invoice_id` names it, `failure` is `vat_id_invalid`, and
42
+ `POST /api/billing/invoices/:id/pay` answers `409 target_state_conflict`,
43
+ rule `vat_id_invalid`, while it is held. A charged-back payment is never
44
+ recharged automatically: `next_retry_at` is `null`, `failure` is
45
+ `charged_back`.
39
46
  - **The `billing` route section**, twelve routes: `GET /api/billing`, the
40
47
  checkout and its status, the VAT-ID check, billing details, changes,
41
48
  the payment method, cancel and resume, an invoice's PDF and paying an
@@ -9605,7 +9605,7 @@
9605
9605
  }
9606
9606
  }
9607
9607
  },
9608
- "description": "`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; cancel, resume, the details and the VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan and its limits still come from `GET /api/org/plan` (#103) and are not repeated here."
9608
+ "description": "`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; cancel, resume, the details and the VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here."
9609
9609
  }
9610
9610
  },
9611
9611
  "/api/billing/checkout": {
@@ -9835,7 +9835,7 @@
9835
9835
  }
9836
9836
  }
9837
9837
  },
9838
- "description": "The body names the **absolute** target — plan, cycle and add-ons — never a delta: the route compares it with the org's current state and splits the difference. The increasing part is charged now, through the same proration `changeNetCents` computes, and takes effect the moment Mollie accepts the `recurring` payment with anything but `failed`, `canceled` or `expired` — card mandates, Apple Pay's included, usually answer `paid` within seconds, a PayPal one may stay `pending` for a while; if it fails later, its open invoice enters dunning like a failed renewal. If Mollie refuses or does not answer, nothing is applied and this answers `502 payment_provider_unavailable` instead. The decreasing part — a lower plan, yearly → monthly, fewer add-ons — is stored as a pending change and applied at the period's end, same as `PUT /api/org/plan/change`; a lower plan over the target's limits answers `409 plan_limit` and the console opens #103's choose-what-stays page. Any increase first withdraws a pending downgrade or cancel, exactly as the admin route does. `409 target_state_conflict` names `billing` with rule `no_account` (no checkout yet — use `POST /api/billing/checkout`), `past_due` (an open invoice has to be paid first) or `no_valid_mandate` (the payment method needs renewing first, `POST /api/billing/payment-method`). `charged` in the response is the invoice from the part charged now, or `null` when the whole request was a decrease.",
9838
+ "description": "The body names the **absolute** target — plan, cycle and add-ons — never a delta: the route compares it with the org's current state and splits the difference. The increasing part is charged now, through the same proration `changeNetCents` computes, and takes effect the moment Mollie accepts the `recurring` payment with anything but `failed`, `canceled` or `expired` — card mandates, Apple Pay's included, usually answer `paid` within seconds, a PayPal one may stay `pending` for a while; if it fails later, its open invoice enters dunning like a failed renewal. If Mollie refuses or does not answer, nothing is applied and this answers `502 payment_provider_unavailable` instead. The decreasing part — a lower plan, yearly → monthly, fewer add-ons — is stored as a pending change and applied at the period's end, same as `PUT /api/org/plan/change`; a lower plan over the target's limits answers `409 plan_limit` and the console opens its choose-what-stays page. Any increase first withdraws a pending downgrade or cancel, exactly as the admin route does. `409 target_state_conflict` names `billing` with rule `no_account` (no checkout yet — use `POST /api/billing/checkout`), `past_due` (an open invoice has to be paid first) or `no_valid_mandate` (the payment method needs renewing first, `POST /api/billing/payment-method`). `charged` in the response is the invoice from the part charged now, or `null` when the whole request was a decrease.",
9839
9839
  "requestBody": {
9840
9840
  "required": true,
9841
9841
  "content": {
@@ -9883,7 +9883,7 @@
9883
9883
  }
9884
9884
  }
9885
9885
  },
9886
- "description": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. Creates a hosted `first` payment on the existing Mollie customer, restricted to the chosen method (`card` → Mollie's `creditcard`, `paypal`, `applepay`). For `card` and `paypal` it is a payment of **0.00** in the org's currency that pays no open invoice: the invoice stays open, the next dunning retry charges the new mandate, and `POST /api/billing/invoices/:id/pay` still pays it at once. `applepay` behaves the same where Mollie accepts a zero-amount Apple Pay payment; where it does not, a change to Apple Pay is only offered together with paying an open invoice — the payment is then that invoice's amount and pays it — and without one this answers `400 validation_error` with `{ field: 'method', rule: 'applepay_needs_open_invoice' }`. A client offers what `payment_method_options` in `GET /api/billing` lists. `404 not_found` when the org has no billing account yet. When the new mandate turns `valid` it becomes the account's — an Apple Pay one is a card mandate, shown as `applepay` — and every other mandate of the customer is revoked.",
9886
+ "description": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. Creates a hosted `first` payment on the existing Mollie customer, restricted to the chosen method (`card` → Mollie's `creditcard`, `paypal`, `applepay`). For `card` and `paypal` it is a payment of `0.00` in the org's currency that pays no open invoice: the invoice stays open, the next dunning retry charges the new mandate — except for an invoice that was charged back, which is never charged again automatically; pay it with `POST /api/billing/invoices/:id/pay` — and that route still pays any open invoice at once. `applepay` behaves the same where Mollie accepts a zero-amount Apple Pay payment; where it does not, a change to Apple Pay is only offered together with paying an open invoice — the payment is then that invoice's amount and pays it — and without one this answers `400 validation_error` with `{ field: 'method', rule: 'applepay_needs_open_invoice' }`. A client offers what `payment_method_options` in `GET /api/billing` lists. `404 not_found` when the org has no billing account yet. When the new mandate turns `valid` it becomes the account's — an Apple Pay one is a card mandate, shown as `applepay` — and every other mandate of the customer is revoked.",
9887
9887
  "requestBody": {
9888
9888
  "required": true,
9889
9889
  "content": {
@@ -9931,7 +9931,7 @@
9931
9931
  }
9932
9932
  }
9933
9933
  },
9934
- "description": "A body is optional — `reason` alone, and nobody but Fleetless reads it. `404 not_found` when the org has no billing account to cancel. Takes effect at the period's end, nothing credited or refunded; over Basic's limits this is refused `409 plan_limit` and the console sends the owner to #103's choose-what-stays page instead, the same as a plan downgrade. \"Cancel at period end\" is not a flag here — it reads as `pending_change.target_plan === 'basic'` on `GET /api/org/plan`.",
9934
+ "description": "A body is optional — `reason` alone, and nobody but Fleetless reads it. `404 not_found` when the org has no billing account to cancel. Takes effect at the period's end, nothing credited or refunded; over Basic's limits this is refused `409 plan_limit` and the console sends the owner to its choose-what-stays page instead, the same as a plan downgrade. \"Cancel at period end\" is not a flag here — it reads as `pending_change.target_plan === 'basic'` on `GET /api/org/plan`.",
9935
9935
  "requestBody": {
9936
9936
  "required": false,
9937
9937
  "content": {
@@ -10048,7 +10048,7 @@
10048
10048
  "name": "id",
10049
10049
  "in": "path",
10050
10050
  "required": true,
10051
- "description": "The invoice id, from `billingInvoice.id`, of the open invoice to pay.",
10051
+ "description": "The invoice id, from `billingInvoice.id`, of the open invoice to pay — or a due charge's id, from `dunning.invoice_id`.",
10052
10052
  "schema": {
10053
10053
  "type": "string"
10054
10054
  }
@@ -10076,7 +10076,7 @@
10076
10076
  }
10077
10077
  }
10078
10078
  },
10079
- "description": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. `409 target_state_conflict` names `invoice` with rule `not_open` when the invoice is already `paid` or `uncollectible` — there is nothing left to pay. Paying the open invoice of a locked org unlocks it and keeps the plan running to the period's end, the same as a renewal that succeeds on a retry. `404 not_found` for an unknown id or one from another org."
10079
+ "description": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. `409 target_state_conflict` names `invoice` with rule `not_open` when the invoice is already `paid` or `uncollectible` — there is nothing left to pay. Paying the open invoice of a locked org unlocks it and keeps the plan running to the period's end, the same as a renewal that succeeds on a retry. `:id` may also be a due charge's id from `dunning.invoice_id` in `GET /api/billing`: while the payer's VAT ID is unsettled a held renewal is a due charge that has no number yet, and it is numbered and issued as an invoice once this payment is paid. The payment charges the amount owed (`dunning.gross_cents`). While that due charge is held by the VAT ID this answers `409 target_state_conflict` with `{ field: 'billing', rule: 'vat_id_invalid' }`. `404 not_found` for an unknown id or one from another org."
10080
10080
  }
10081
10081
  }
10082
10082
  },
@@ -12813,13 +12813,13 @@
12813
12813
  "type": "string",
12814
12814
  "format": "uuid",
12815
12815
  "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)$",
12816
- "description": "The open invoice dunning is chasing."
12816
+ "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."
12817
12817
  },
12818
12818
  "gross_cents": {
12819
12819
  "type": "integer",
12820
12820
  "minimum": -9007199254740991,
12821
12821
  "maximum": 9007199254740991,
12822
- "description": "The amount owed, in integer cents."
12822
+ "description": "The amount owed, in integer cents — after a partial chargeback only the charged-back part."
12823
12823
  },
12824
12824
  "due_at": {
12825
12825
  "type": "string",
@@ -12838,7 +12838,7 @@
12838
12838
  "type": "null"
12839
12839
  }
12840
12840
  ],
12841
- "description": "The next retry, or `null` once retries are exhausted."
12841
+ "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."
12842
12842
  },
12843
12843
  "lock_at": {
12844
12844
  "type": "string",
@@ -12855,7 +12855,7 @@
12855
12855
  "type": "null"
12856
12856
  }
12857
12857
  ],
12858
- "description": "Mollie's own reason, e.g. 'card_expired'; 'vat_id_invalid' when VIES turned definitive."
12858
+ "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."
12859
12859
  }
12860
12860
  },
12861
12861
  "required": [
@@ -12872,7 +12872,7 @@
12872
12872
  "type": "null"
12873
12873
  }
12874
12874
  ],
12875
- "description": "`null` while nothing is overdue."
12875
+ "description": "`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced."
12876
12876
  }
12877
12877
  },
12878
12878
  "required": [
@@ -13632,13 +13632,13 @@
13632
13632
  "type": "string",
13633
13633
  "format": "uuid",
13634
13634
  "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)$",
13635
- "description": "The open invoice dunning is chasing."
13635
+ "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."
13636
13636
  },
13637
13637
  "gross_cents": {
13638
13638
  "type": "integer",
13639
13639
  "minimum": -9007199254740991,
13640
13640
  "maximum": 9007199254740991,
13641
- "description": "The amount owed, in integer cents."
13641
+ "description": "The amount owed, in integer cents — after a partial chargeback only the charged-back part."
13642
13642
  },
13643
13643
  "due_at": {
13644
13644
  "type": "string",
@@ -13657,7 +13657,7 @@
13657
13657
  "type": "null"
13658
13658
  }
13659
13659
  ],
13660
- "description": "The next retry, or `null` once retries are exhausted."
13660
+ "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."
13661
13661
  },
13662
13662
  "lock_at": {
13663
13663
  "type": "string",
@@ -13674,7 +13674,7 @@
13674
13674
  "type": "null"
13675
13675
  }
13676
13676
  ],
13677
- "description": "Mollie's own reason, e.g. 'card_expired'; 'vat_id_invalid' when VIES turned definitive."
13677
+ "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."
13678
13678
  }
13679
13679
  },
13680
13680
  "required": [
@@ -13691,7 +13691,7 @@
13691
13691
  "type": "null"
13692
13692
  }
13693
13693
  ],
13694
- "description": "`null` while nothing is overdue."
13694
+ "description": "`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced."
13695
13695
  }
13696
13696
  },
13697
13697
  "required": [
@@ -6495,7 +6495,7 @@
6495
6495
  "tier_required"
6496
6496
  ],
6497
6497
  "transport": "http",
6498
- "notes": "`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; cancel, resume, the details and the VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan and its limits still come from `GET /api/org/plan` (#103) and are not repeated here."
6498
+ "notes": "`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; cancel, resume, the details and the VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here."
6499
6499
  },
6500
6500
  {
6501
6501
  "method": "POST",
@@ -6631,7 +6631,7 @@
6631
6631
  "payment_provider_unavailable"
6632
6632
  ],
6633
6633
  "transport": "http",
6634
- "notes": "The body names the **absolute** target — plan, cycle and add-ons — never a delta: the route compares it with the org's current state and splits the difference. The increasing part is charged now, through the same proration `changeNetCents` computes, and takes effect the moment Mollie accepts the `recurring` payment with anything but `failed`, `canceled` or `expired` — card mandates, Apple Pay's included, usually answer `paid` within seconds, a PayPal one may stay `pending` for a while; if it fails later, its open invoice enters dunning like a failed renewal. If Mollie refuses or does not answer, nothing is applied and this answers `502 payment_provider_unavailable` instead. The decreasing part — a lower plan, yearly → monthly, fewer add-ons — is stored as a pending change and applied at the period's end, same as `PUT /api/org/plan/change`; a lower plan over the target's limits answers `409 plan_limit` and the console opens #103's choose-what-stays page. Any increase first withdraws a pending downgrade or cancel, exactly as the admin route does. `409 target_state_conflict` names `billing` with rule `no_account` (no checkout yet — use `POST /api/billing/checkout`), `past_due` (an open invoice has to be paid first) or `no_valid_mandate` (the payment method needs renewing first, `POST /api/billing/payment-method`). `charged` in the response is the invoice from the part charged now, or `null` when the whole request was a decrease."
6634
+ "notes": "The body names the **absolute** target — plan, cycle and add-ons — never a delta: the route compares it with the org's current state and splits the difference. The increasing part is charged now, through the same proration `changeNetCents` computes, and takes effect the moment Mollie accepts the `recurring` payment with anything but `failed`, `canceled` or `expired` — card mandates, Apple Pay's included, usually answer `paid` within seconds, a PayPal one may stay `pending` for a while; if it fails later, its open invoice enters dunning like a failed renewal. If Mollie refuses or does not answer, nothing is applied and this answers `502 payment_provider_unavailable` instead. The decreasing part — a lower plan, yearly → monthly, fewer add-ons — is stored as a pending change and applied at the period's end, same as `PUT /api/org/plan/change`; a lower plan over the target's limits answers `409 plan_limit` and the console opens its choose-what-stays page. Any increase first withdraws a pending downgrade or cancel, exactly as the admin route does. `409 target_state_conflict` names `billing` with rule `no_account` (no checkout yet — use `POST /api/billing/checkout`), `past_due` (an open invoice has to be paid first) or `no_valid_mandate` (the payment method needs renewing first, `POST /api/billing/payment-method`). `charged` in the response is the invoice from the part charged now, or `null` when the whole request was a decrease."
6635
6635
  },
6636
6636
  {
6637
6637
  "method": "POST",
@@ -6659,7 +6659,7 @@
6659
6659
  "payment_provider_unavailable"
6660
6660
  ],
6661
6661
  "transport": "http",
6662
- "notes": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. Creates a hosted `first` payment on the existing Mollie customer, restricted to the chosen method (`card` → Mollie's `creditcard`, `paypal`, `applepay`). For `card` and `paypal` it is a payment of **0.00** in the org's currency that pays no open invoice: the invoice stays open, the next dunning retry charges the new mandate, and `POST /api/billing/invoices/:id/pay` still pays it at once. `applepay` behaves the same where Mollie accepts a zero-amount Apple Pay payment; where it does not, a change to Apple Pay is only offered together with paying an open invoice — the payment is then that invoice's amount and pays it — and without one this answers `400 validation_error` with `{ field: 'method', rule: 'applepay_needs_open_invoice' }`. A client offers what `payment_method_options` in `GET /api/billing` lists. `404 not_found` when the org has no billing account yet. When the new mandate turns `valid` it becomes the account's — an Apple Pay one is a card mandate, shown as `applepay` — and every other mandate of the customer is revoked."
6662
+ "notes": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. Creates a hosted `first` payment on the existing Mollie customer, restricted to the chosen method (`card` → Mollie's `creditcard`, `paypal`, `applepay`). For `card` and `paypal` it is a payment of `0.00` in the org's currency that pays no open invoice: the invoice stays open, the next dunning retry charges the new mandate — except for an invoice that was charged back, which is never charged again automatically; pay it with `POST /api/billing/invoices/:id/pay` — and that route still pays any open invoice at once. `applepay` behaves the same where Mollie accepts a zero-amount Apple Pay payment; where it does not, a change to Apple Pay is only offered together with paying an open invoice — the payment is then that invoice's amount and pays it — and without one this answers `400 validation_error` with `{ field: 'method', rule: 'applepay_needs_open_invoice' }`. A client offers what `payment_method_options` in `GET /api/billing` lists. `404 not_found` when the org has no billing account yet. When the new mandate turns `valid` it becomes the account's — an Apple Pay one is a card mandate, shown as `applepay` — and every other mandate of the customer is revoked."
6663
6663
  },
6664
6664
  {
6665
6665
  "method": "POST",
@@ -6686,7 +6686,7 @@
6686
6686
  "plan_limit"
6687
6687
  ],
6688
6688
  "transport": "http",
6689
- "notes": "A body is optional — `reason` alone, and nobody but Fleetless reads it. `404 not_found` when the org has no billing account to cancel. Takes effect at the period's end, nothing credited or refunded; over Basic's limits this is refused `409 plan_limit` and the console sends the owner to #103's choose-what-stays page instead, the same as a plan downgrade. \"Cancel at period end\" is not a flag here — it reads as `pending_change.target_plan === 'basic'` on `GET /api/org/plan`."
6689
+ "notes": "A body is optional — `reason` alone, and nobody but Fleetless reads it. `404 not_found` when the org has no billing account to cancel. Takes effect at the period's end, nothing credited or refunded; over Basic's limits this is refused `409 plan_limit` and the console sends the owner to its choose-what-stays page instead, the same as a plan downgrade. \"Cancel at period end\" is not a flag here — it reads as `pending_change.target_plan === 'basic'` on `GET /api/org/plan`."
6690
6690
  },
6691
6691
  {
6692
6692
  "method": "POST",
@@ -6755,7 +6755,7 @@
6755
6755
  "params": [
6756
6756
  {
6757
6757
  "name": "id",
6758
- "description": "The invoice id, from `billingInvoice.id`, of the open invoice to pay."
6758
+ "description": "The invoice id, from `billingInvoice.id`, of the open invoice to pay — or a due charge's id, from `dunning.invoice_id`."
6759
6759
  }
6760
6760
  ],
6761
6761
  "query": null,
@@ -6773,7 +6773,7 @@
6773
6773
  "payment_provider_unavailable"
6774
6774
  ],
6775
6775
  "transport": "http",
6776
- "notes": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. `409 target_state_conflict` names `invoice` with rule `not_open` when the invoice is already `paid` or `uncollectible` — there is nothing left to pay. Paying the open invoice of a locked org unlocks it and keeps the plan running to the period's end, the same as a renewal that succeeds on a retry. `404 not_found` for an unknown id or one from another org."
6776
+ "notes": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. `409 target_state_conflict` names `invoice` with rule `not_open` when the invoice is already `paid` or `uncollectible` — there is nothing left to pay. Paying the open invoice of a locked org unlocks it and keeps the plan running to the period's end, the same as a renewal that succeeds on a retry. `:id` may also be a due charge's id from `dunning.invoice_id` in `GET /api/billing`: while the payer's VAT ID is unsettled a held renewal is a due charge that has no number yet, and it is numbered and issued as an invoice once this payment is paid. The payment charges the amount owed (`dunning.gross_cents`). While that due charge is held by the VAT ID this answers `409 target_state_conflict` with `{ field: 'billing', rule: 'vat_id_invalid' }`. `404 not_found` for an unknown id or one from another org."
6777
6777
  },
6778
6778
  {
6779
6779
  "method": "POST",
@@ -414,13 +414,13 @@
414
414
  "type": "string",
415
415
  "format": "uuid",
416
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."
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
418
  },
419
419
  "gross_cents": {
420
420
  "type": "integer",
421
421
  "minimum": -9007199254740991,
422
422
  "maximum": 9007199254740991,
423
- "description": "The amount owed, in integer cents."
423
+ "description": "The amount owed, in integer cents — after a partial chargeback only the charged-back part."
424
424
  },
425
425
  "due_at": {
426
426
  "type": "string",
@@ -439,7 +439,7 @@
439
439
  "type": "null"
440
440
  }
441
441
  ],
442
- "description": "The next retry, or `null` once retries are exhausted."
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
443
  },
444
444
  "lock_at": {
445
445
  "type": "string",
@@ -456,7 +456,7 @@
456
456
  "type": "null"
457
457
  }
458
458
  ],
459
- "description": "Mollie's own reason, e.g. 'card_expired'; 'vat_id_invalid' when VIES turned definitive."
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."
460
460
  }
461
461
  },
462
462
  "required": [
@@ -473,7 +473,7 @@
473
473
  "type": "null"
474
474
  }
475
475
  ],
476
- "description": "`null` while nothing is overdue."
476
+ "description": "`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced."
477
477
  }
478
478
  },
479
479
  "required": [
@@ -411,13 +411,13 @@
411
411
  "type": "string",
412
412
  "format": "uuid",
413
413
  "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)$",
414
- "description": "The open invoice dunning is chasing."
414
+ "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."
415
415
  },
416
416
  "gross_cents": {
417
417
  "type": "integer",
418
418
  "minimum": -9007199254740991,
419
419
  "maximum": 9007199254740991,
420
- "description": "The amount owed, in integer cents."
420
+ "description": "The amount owed, in integer cents — after a partial chargeback only the charged-back part."
421
421
  },
422
422
  "due_at": {
423
423
  "type": "string",
@@ -436,7 +436,7 @@
436
436
  "type": "null"
437
437
  }
438
438
  ],
439
- "description": "The next retry, or `null` once retries are exhausted."
439
+ "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."
440
440
  },
441
441
  "lock_at": {
442
442
  "type": "string",
@@ -453,7 +453,7 @@
453
453
  "type": "null"
454
454
  }
455
455
  ],
456
- "description": "Mollie's own reason, e.g. 'card_expired'; 'vat_id_invalid' when VIES turned definitive."
456
+ "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."
457
457
  }
458
458
  },
459
459
  "required": [
@@ -470,7 +470,7 @@
470
470
  "type": "null"
471
471
  }
472
472
  ],
473
- "description": "`null` while nothing is overdue."
473
+ "description": "`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced."
474
474
  }
475
475
  },
476
476
  "required": [
package/dist/billing.js CHANGED
@@ -431,15 +431,24 @@ export const billingAccount = z.object({
431
431
  addons: orgAddons.nullable().meta({ description: "Add-on counts queued for the period's end, or `null`." }),
432
432
  }).meta({ description: "What takes effect at the period's end." }),
433
433
  dunning: z.object({
434
- invoice_id: z.uuid().meta({ description: 'The open invoice dunning is chasing.' }),
435
- gross_cents: z.number().int().meta({ description: 'The amount owed, in integer cents.' }),
434
+ invoice_id: z.uuid().meta({
435
+ description: 'The open invoice dunning is chasing — or, while the payer\'s VAT ID is unsettled, the due charge that becomes one: it has ' +
436
+ 'no number yet and is not in `invoices`. `POST /api/billing/invoices/:id/pay` takes either.',
437
+ }),
438
+ gross_cents: z.number().int().meta({
439
+ description: 'The amount owed, in integer cents — after a partial chargeback only the charged-back part.',
440
+ }),
436
441
  due_at: z.iso.datetime().meta({ description: "The charge's due date; retries and the lock count from here." }),
437
- next_retry_at: z.iso.datetime().nullable().meta({ description: 'The next retry, or `null` once retries are exhausted.' }),
442
+ next_retry_at: z.iso.datetime().nullable().meta({
443
+ description: 'The next automatic retry, or `null` once retries are exhausted. Always `null` after a chargeback: a charged-back ' +
444
+ 'payment is never charged again automatically.',
445
+ }),
438
446
  lock_at: z.iso.datetime().meta({ description: 'When the org is locked if still unpaid (`BILLING_LOCK_DAY`).' }),
439
447
  failure: z.string().nullable().meta({
440
- description: "Mollie's own reason, e.g. 'card_expired'; 'vat_id_invalid' when VIES turned definitive.",
448
+ description: "Mollie's own reason, e.g. 'card_expired'; 'vat_id_invalid' while a renewal is held because VIES does not confirm the " +
449
+ "VAT ID; 'charged_back' after a chargeback or a lost PayPal dispute.",
441
450
  }),
442
- }).nullable().meta({ description: '`null` while nothing is overdue.' }),
451
+ }).nullable().meta({ description: '`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced.' }),
443
452
  });
444
453
  /** `GET /api/billing`'s answer, and what every other billing route hands back after a change. */
445
454
  export const billingView = z.object({
package/dist/routes.js CHANGED
@@ -2882,7 +2882,7 @@ export const ROUTES = [
2882
2882
  notes: '`available: false` when `MOLLIE_API_KEY` is not configured — this cloud takes no payments, and every billing route that ' +
2883
2883
  'charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; cancel, resume, the details and the ' +
2884
2884
  'VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan ' +
2885
- 'and its limits still come from `GET /api/org/plan` (#103) and are not repeated here.',
2885
+ 'and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here.',
2886
2886
  },
2887
2887
  {
2888
2888
  method: 'POST', path: '/api/billing/checkout', section: 'billing',
@@ -2950,7 +2950,7 @@ export const ROUTES = [
2950
2950
  'fails later, its open invoice enters dunning like a failed renewal. If Mollie refuses or does not answer, nothing is applied ' +
2951
2951
  'and this answers `502 payment_provider_unavailable` instead. The decreasing part — a lower plan, yearly → monthly, fewer add-ons — ' +
2952
2952
  'is stored as a pending change and applied at the period\'s end, same as `PUT /api/org/plan/change`; a lower plan over the target\'s ' +
2953
- 'limits answers `409 plan_limit` and the console opens #103\'s choose-what-stays page. Any increase first withdraws a pending ' +
2953
+ 'limits answers `409 plan_limit` and the console opens its choose-what-stays page. Any increase first withdraws a pending ' +
2954
2954
  'downgrade or cancel, exactly as the admin route does. `409 target_state_conflict` names `billing` with rule `no_account` (no ' +
2955
2955
  'checkout yet — use `POST /api/billing/checkout`), `past_due` (an open invoice has to be paid first) or `no_valid_mandate` (the ' +
2956
2956
  'payment method needs renewing first, `POST /api/billing/payment-method`). `charged` in the response is the invoice from the part ' +
@@ -2965,8 +2965,10 @@ export const ROUTES = [
2965
2965
  transport: 'http',
2966
2966
  notes: 'Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. Creates a hosted `first` payment on the ' +
2967
2967
  'existing Mollie customer, restricted to the chosen method (`card` → Mollie\'s `creditcard`, `paypal`, `applepay`). For `card` ' +
2968
- 'and `paypal` it is a payment of **0.00** in the org\'s currency that pays no open invoice: the invoice stays open, the next ' +
2969
- 'dunning retry charges the new mandate, and `POST /api/billing/invoices/:id/pay` still pays it at once. `applepay` behaves the ' +
2968
+ 'and `paypal` it is a payment of `0.00` in the org\'s currency that pays no open invoice: the invoice stays open, the next ' +
2969
+ 'dunning retry charges the new mandate — except for an invoice that was charged back, which is never charged again ' +
2970
+ 'automatically; pay it with `POST /api/billing/invoices/:id/pay` — and that route still pays any open invoice at once. ' +
2971
+ '`applepay` behaves the ' +
2970
2972
  'same where Mollie accepts a zero-amount Apple Pay payment; where it does not, a change to Apple Pay is only offered together ' +
2971
2973
  'with paying an open invoice — the payment is then that invoice\'s amount and pays it — and without one this answers ' +
2972
2974
  '`400 validation_error` with `{ field: \'method\', rule: \'applepay_needs_open_invoice\' }`. A client offers what ' +
@@ -2982,7 +2984,7 @@ export const ROUTES = [
2982
2984
  errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'plan_limit'], transport: 'http',
2983
2985
  notes: 'A body is optional — `reason` alone, and nobody but Fleetless reads it. `404 not_found` when the org has no billing account to ' +
2984
2986
  'cancel. Takes effect at the period\'s end, nothing credited or refunded; over Basic\'s limits this is refused `409 ' +
2985
- 'plan_limit` and the console sends the owner to #103\'s choose-what-stays page instead, the same as a plan downgrade. "Cancel at ' +
2987
+ 'plan_limit` and the console sends the owner to its choose-what-stays page instead, the same as a plan downgrade. "Cancel at ' +
2986
2988
  'period end" is not a flag here — it reads as `pending_change.target_plan === \'basic\'` on `GET /api/org/plan`.',
2987
2989
  },
2988
2990
  {
@@ -3007,14 +3009,18 @@ export const ROUTES = [
3007
3009
  method: 'POST', path: '/api/billing/invoices/:id/pay', section: 'billing',
3008
3010
  summary: 'Pays one open invoice, through a new Mollie payment.',
3009
3011
  audience: 'developer', auth: 'developer', rateLimited: true, ownerTier: true, status: 201,
3010
- params: [{ name: 'id', description: 'The invoice id, from `billingInvoice.id`, of the open invoice to pay.' }],
3012
+ params: [{ name: 'id', description: 'The invoice id, from `billingInvoice.id`, of the open invoice to pay — or a due charge\'s id, from `dunning.invoice_id`.' }],
3011
3013
  query: null, request: null, response: checkoutResponse,
3012
3014
  errors: [...DEVELOPER_GUARD, 'tier_required', 'not_found', 'target_state_conflict', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
3013
3015
  transport: 'http',
3014
3016
  notes: 'Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. `409 target_state_conflict` names `invoice` ' +
3015
3017
  'with rule `not_open` when the invoice is already `paid` or `uncollectible` — there is nothing left to pay. Paying the open ' +
3016
3018
  'invoice of a locked org unlocks it and keeps the plan running to the period\'s end, the same as a renewal that ' +
3017
- 'succeeds on a retry. `404 not_found` for an unknown id or one from another org.',
3019
+ 'succeeds on a retry. `:id` may also be a due charge\'s id from `dunning.invoice_id` in `GET /api/billing`: while the payer\'s ' +
3020
+ 'VAT ID is unsettled a held renewal is a due charge that has no number yet, and it is numbered and issued as an invoice ' +
3021
+ 'once this payment is paid. The payment charges the amount owed (`dunning.gross_cents`). While that due charge is held by ' +
3022
+ 'the VAT ID this answers `409 target_state_conflict` with `{ field: \'billing\', rule: \'vat_id_invalid\' }`. ' +
3023
+ '`404 not_found` for an unknown id or one from another org.',
3018
3024
  },
3019
3025
  {
3020
3026
  method: 'POST', path: '/api/billing/mollie/webhook', section: 'billing',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetless/contracts",
3
- "version": "6.3.0-next.3",
3
+ "version": "6.3.0-next.4",
4
4
  "description": "Fleetless wire contracts: the bridge-cloud protocol, the REST API schemas and the error codes, as zod schemas with generated JSON Schema and OpenAPI artifacts.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Dehne Robotik GmbH",