@fleetless/contracts 6.3.0-next.2 → 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 +17 -2
- package/artifacts/openapi.json +105 -37
- package/artifacts/routes.json +7 -7
- package/artifacts/schema/billing-change-response.schema.json +48 -14
- package/artifacts/schema/billing-view.schema.json +48 -14
- package/artifacts/schema/payment-method-change-request.schema.json +2 -2
- package/artifacts/schema/payment-method.schema.json +15 -9
- package/dist/billing.d.ts +39 -10
- package/dist/billing.js +33 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/routes.js +25 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -20,14 +20,29 @@ version.
|
|
|
20
20
|
`prorateCents`, `changeNetCents`, `chargeAmounts`, `checkoutQuote`); and
|
|
21
21
|
the dunning schedule `BILLING_RETRY_DAYS` and `BILLING_LOCK_DAY`.
|
|
22
22
|
- **The billing read model and requests.** `billingView` (the account, the
|
|
23
|
-
payment method on file, the
|
|
24
|
-
`
|
|
23
|
+
payment method on file, the `payment_method_options` a change may offer
|
|
24
|
+
now, the last 24 invoices), `billingAccount`, `billingInvoice`,
|
|
25
|
+
`paymentMethod`, `billingDetails` and `billingAddress`;
|
|
25
26
|
the requests `checkoutRequest`, `vatIdCheckRequest`,
|
|
26
27
|
`billingChangeRequest` (absolute counts, not deltas),
|
|
27
28
|
`billingCancelRequest`, `billingDetailsUpdate` and
|
|
28
29
|
`paymentMethodChangeRequest`; the answers `checkoutResponse`,
|
|
29
30
|
`checkoutStatus`, `vatIdCheckResponse` and `billingChangeResponse`. Each
|
|
30
31
|
has a JSON Schema in `artifacts/schema/`.
|
|
32
|
+
- **Card, PayPal and Apple Pay.** `paymentMethodKind`
|
|
33
|
+
(`card | paypal | applepay`) is what `paymentMethodChangeRequest` names
|
|
34
|
+
and what `paymentMethod` shows: `applepay` carries the card fields,
|
|
35
|
+
because Mollie stores an Apple Pay mandate as a card mandate. A change
|
|
36
|
+
to Apple Pay may be refused with `400 validation_error`, rule
|
|
37
|
+
`applepay_needs_open_invoice`, where it can only be made while paying an
|
|
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`.
|
|
31
46
|
- **The `billing` route section**, twelve routes: `GET /api/billing`, the
|
|
32
47
|
checkout and its status, the VAT-ID check, billing details, changes,
|
|
33
48
|
the payment method, cancel and resume, an invoice's PDF and paying an
|
package/artifacts/openapi.json
CHANGED
|
@@ -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` (
|
|
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": {
|
|
@@ -9643,7 +9643,7 @@
|
|
|
9643
9643
|
}
|
|
9644
9644
|
}
|
|
9645
9645
|
},
|
|
9646
|
-
"description": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/payment-method` and `POST /api/billing/invoices/:id/pay` — the three routes that mint a Mollie checkout. `400 validation_error` names who may not pay with these rules: `{ field: 'billing.address.country', rule: 'eu_person' }` for a person in another EU country, `{ field: 'billing.vat_id', rule: 'vat_id_required' }` for a company there with no VAT ID, `{ field: 'billing.vat_id', rule: 'vat_id_invalid' }` once VIES has said so, and `{ field: 'accept_withdrawal', rule: 'required' }` for a person who did not confirm it. `409 target_state_conflict` names `plan` with rule `already_billed` when the org already has an `active` or `past_due` billing account — checkout is for the first payment only, every later change is `POST /api/billing/change`. `checkout_url` is Mollie's hosted page; the return lands on `<console>/settings/billing?checkout=<checkout_id>`, which polls `GET /api/billing/checkout/:id` until the webhook — or the poll itself — has reconciled the payment. `409 plan_limit` is the org's own usage against the plan being bought.",
|
|
9646
|
+
"description": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/payment-method` and `POST /api/billing/invoices/:id/pay` — the three routes that mint a Mollie checkout. `400 validation_error` names who may not pay with these rules: `{ field: 'billing.address.country', rule: 'eu_person' }` for a person in another EU country, `{ field: 'billing.vat_id', rule: 'vat_id_required' }` for a company there with no VAT ID, `{ field: 'billing.vat_id', rule: 'vat_id_invalid' }` once VIES has said so, and `{ field: 'accept_withdrawal', rule: 'required' }` for a person who did not confirm it. `409 target_state_conflict` names `plan` with rule `already_billed` when the org already has an `active` or `past_due` billing account — checkout is for the first payment only, every later change is `POST /api/billing/change`. `checkout_url` is Mollie's hosted page, where the payer chooses card, PayPal or Apple Pay; the return lands on `<console>/settings/billing?checkout=<checkout_id>`, which polls `GET /api/billing/checkout/:id` until the webhook — or the poll itself — has reconciled the payment. `409 plan_limit` is the org's own usage against the plan being bought.",
|
|
9647
9647
|
"requestBody": {
|
|
9648
9648
|
"required": true,
|
|
9649
9649
|
"content": {
|
|
@@ -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` —
|
|
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 `first` payment on the existing Mollie customer
|
|
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
|
|
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'
|
|
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": [
|
|
@@ -12936,23 +12936,29 @@
|
|
|
12936
12936
|
"properties": {
|
|
12937
12937
|
"kind": {
|
|
12938
12938
|
"type": "string",
|
|
12939
|
-
"const": "
|
|
12940
|
-
"description": "A
|
|
12939
|
+
"const": "applepay",
|
|
12940
|
+
"description": "A card mandate from an Apple Pay first payment — Mollie stores it as `creditcard`; Fleetless labels it Apple Pay."
|
|
12941
12941
|
},
|
|
12942
|
-
"
|
|
12942
|
+
"brand": {
|
|
12943
12943
|
"type": "string",
|
|
12944
|
-
"description": "The
|
|
12944
|
+
"description": "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'."
|
|
12945
12945
|
},
|
|
12946
|
-
"
|
|
12946
|
+
"last4": {
|
|
12947
12947
|
"type": "string",
|
|
12948
|
-
"pattern": "
|
|
12949
|
-
"description": "The last four
|
|
12948
|
+
"pattern": "^\\d{4}$",
|
|
12949
|
+
"description": "The last four digits of the card behind Apple Pay."
|
|
12950
|
+
},
|
|
12951
|
+
"expires": {
|
|
12952
|
+
"type": "string",
|
|
12953
|
+
"pattern": "^\\d{2}\\/\\d{2}$",
|
|
12954
|
+
"description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
|
|
12950
12955
|
}
|
|
12951
12956
|
},
|
|
12952
12957
|
"required": [
|
|
12953
12958
|
"kind",
|
|
12954
|
-
"
|
|
12955
|
-
"
|
|
12959
|
+
"brand",
|
|
12960
|
+
"last4",
|
|
12961
|
+
"expires"
|
|
12956
12962
|
],
|
|
12957
12963
|
"additionalProperties": false
|
|
12958
12964
|
},
|
|
@@ -12983,6 +12989,33 @@
|
|
|
12983
12989
|
],
|
|
12984
12990
|
"description": "The payment method on file, or `null`."
|
|
12985
12991
|
},
|
|
12992
|
+
"payment_method_options": {
|
|
12993
|
+
"type": "array",
|
|
12994
|
+
"items": {
|
|
12995
|
+
"type": "object",
|
|
12996
|
+
"properties": {
|
|
12997
|
+
"method": {
|
|
12998
|
+
"type": "string",
|
|
12999
|
+
"enum": [
|
|
13000
|
+
"card",
|
|
13001
|
+
"paypal",
|
|
13002
|
+
"applepay"
|
|
13003
|
+
],
|
|
13004
|
+
"description": "A method `POST /api/billing/payment-method` accepts now."
|
|
13005
|
+
},
|
|
13006
|
+
"pays_invoice": {
|
|
13007
|
+
"type": "boolean",
|
|
13008
|
+
"description": "Whether changing to it also pays the open invoice — `true` only for `applepay` when a zero-amount Apple Pay payment is not available."
|
|
13009
|
+
}
|
|
13010
|
+
},
|
|
13011
|
+
"required": [
|
|
13012
|
+
"method",
|
|
13013
|
+
"pays_invoice"
|
|
13014
|
+
],
|
|
13015
|
+
"additionalProperties": false
|
|
13016
|
+
},
|
|
13017
|
+
"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."
|
|
13018
|
+
},
|
|
12986
13019
|
"invoices": {
|
|
12987
13020
|
"type": "array",
|
|
12988
13021
|
"items": {
|
|
@@ -13067,6 +13100,7 @@
|
|
|
13067
13100
|
"available",
|
|
13068
13101
|
"account",
|
|
13069
13102
|
"payment_method",
|
|
13103
|
+
"payment_method_options",
|
|
13070
13104
|
"invoices"
|
|
13071
13105
|
],
|
|
13072
13106
|
"additionalProperties": false,
|
|
@@ -13598,13 +13632,13 @@
|
|
|
13598
13632
|
"type": "string",
|
|
13599
13633
|
"format": "uuid",
|
|
13600
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)$",
|
|
13601
|
-
"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."
|
|
13602
13636
|
},
|
|
13603
13637
|
"gross_cents": {
|
|
13604
13638
|
"type": "integer",
|
|
13605
13639
|
"minimum": -9007199254740991,
|
|
13606
13640
|
"maximum": 9007199254740991,
|
|
13607
|
-
"description": "The amount owed, in integer cents."
|
|
13641
|
+
"description": "The amount owed, in integer cents — after a partial chargeback only the charged-back part."
|
|
13608
13642
|
},
|
|
13609
13643
|
"due_at": {
|
|
13610
13644
|
"type": "string",
|
|
@@ -13623,7 +13657,7 @@
|
|
|
13623
13657
|
"type": "null"
|
|
13624
13658
|
}
|
|
13625
13659
|
],
|
|
13626
|
-
"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."
|
|
13627
13661
|
},
|
|
13628
13662
|
"lock_at": {
|
|
13629
13663
|
"type": "string",
|
|
@@ -13640,7 +13674,7 @@
|
|
|
13640
13674
|
"type": "null"
|
|
13641
13675
|
}
|
|
13642
13676
|
],
|
|
13643
|
-
"description": "Mollie's own reason, e.g. 'card_expired'; 'vat_id_invalid'
|
|
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."
|
|
13644
13678
|
}
|
|
13645
13679
|
},
|
|
13646
13680
|
"required": [
|
|
@@ -13657,7 +13691,7 @@
|
|
|
13657
13691
|
"type": "null"
|
|
13658
13692
|
}
|
|
13659
13693
|
],
|
|
13660
|
-
"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."
|
|
13661
13695
|
}
|
|
13662
13696
|
},
|
|
13663
13697
|
"required": [
|
|
@@ -13721,23 +13755,29 @@
|
|
|
13721
13755
|
"properties": {
|
|
13722
13756
|
"kind": {
|
|
13723
13757
|
"type": "string",
|
|
13724
|
-
"const": "
|
|
13725
|
-
"description": "A
|
|
13758
|
+
"const": "applepay",
|
|
13759
|
+
"description": "A card mandate from an Apple Pay first payment — Mollie stores it as `creditcard`; Fleetless labels it Apple Pay."
|
|
13726
13760
|
},
|
|
13727
|
-
"
|
|
13761
|
+
"brand": {
|
|
13728
13762
|
"type": "string",
|
|
13729
|
-
"description": "The
|
|
13763
|
+
"description": "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'."
|
|
13730
13764
|
},
|
|
13731
|
-
"
|
|
13765
|
+
"last4": {
|
|
13732
13766
|
"type": "string",
|
|
13733
|
-
"pattern": "
|
|
13734
|
-
"description": "The last four
|
|
13767
|
+
"pattern": "^\\d{4}$",
|
|
13768
|
+
"description": "The last four digits of the card behind Apple Pay."
|
|
13769
|
+
},
|
|
13770
|
+
"expires": {
|
|
13771
|
+
"type": "string",
|
|
13772
|
+
"pattern": "^\\d{2}\\/\\d{2}$",
|
|
13773
|
+
"description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
|
|
13735
13774
|
}
|
|
13736
13775
|
},
|
|
13737
13776
|
"required": [
|
|
13738
13777
|
"kind",
|
|
13739
|
-
"
|
|
13740
|
-
"
|
|
13778
|
+
"brand",
|
|
13779
|
+
"last4",
|
|
13780
|
+
"expires"
|
|
13741
13781
|
],
|
|
13742
13782
|
"additionalProperties": false
|
|
13743
13783
|
},
|
|
@@ -13768,6 +13808,33 @@
|
|
|
13768
13808
|
],
|
|
13769
13809
|
"description": "The payment method on file, or `null`."
|
|
13770
13810
|
},
|
|
13811
|
+
"payment_method_options": {
|
|
13812
|
+
"type": "array",
|
|
13813
|
+
"items": {
|
|
13814
|
+
"type": "object",
|
|
13815
|
+
"properties": {
|
|
13816
|
+
"method": {
|
|
13817
|
+
"type": "string",
|
|
13818
|
+
"enum": [
|
|
13819
|
+
"card",
|
|
13820
|
+
"paypal",
|
|
13821
|
+
"applepay"
|
|
13822
|
+
],
|
|
13823
|
+
"description": "A method `POST /api/billing/payment-method` accepts now."
|
|
13824
|
+
},
|
|
13825
|
+
"pays_invoice": {
|
|
13826
|
+
"type": "boolean",
|
|
13827
|
+
"description": "Whether changing to it also pays the open invoice — `true` only for `applepay` when a zero-amount Apple Pay payment is not available."
|
|
13828
|
+
}
|
|
13829
|
+
},
|
|
13830
|
+
"required": [
|
|
13831
|
+
"method",
|
|
13832
|
+
"pays_invoice"
|
|
13833
|
+
],
|
|
13834
|
+
"additionalProperties": false
|
|
13835
|
+
},
|
|
13836
|
+
"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."
|
|
13837
|
+
},
|
|
13771
13838
|
"invoices": {
|
|
13772
13839
|
"type": "array",
|
|
13773
13840
|
"items": {
|
|
@@ -13852,6 +13919,7 @@
|
|
|
13852
13919
|
"available",
|
|
13853
13920
|
"account",
|
|
13854
13921
|
"payment_method",
|
|
13922
|
+
"payment_method_options",
|
|
13855
13923
|
"invoices"
|
|
13856
13924
|
],
|
|
13857
13925
|
"additionalProperties": false
|
|
@@ -21242,9 +21310,9 @@
|
|
|
21242
21310
|
"enum": [
|
|
21243
21311
|
"card",
|
|
21244
21312
|
"paypal",
|
|
21245
|
-
"
|
|
21313
|
+
"applepay"
|
|
21246
21314
|
],
|
|
21247
|
-
"description": "The new mandate's method. `
|
|
21315
|
+
"description": "The new mandate's method. Offer what `billingView.payment_method_options` lists: `applepay` may be refused with `400 validation_error` `{ field: 'method', rule: 'applepay_needs_open_invoice' }` unless an invoice is open."
|
|
21248
21316
|
}
|
|
21249
21317
|
},
|
|
21250
21318
|
"required": [
|
package/artifacts/routes.json
CHANGED
|
@@ -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` (
|
|
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",
|
|
@@ -6524,7 +6524,7 @@
|
|
|
6524
6524
|
"payment_provider_unavailable"
|
|
6525
6525
|
],
|
|
6526
6526
|
"transport": "http",
|
|
6527
|
-
"notes": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/payment-method` and `POST /api/billing/invoices/:id/pay` — the three routes that mint a Mollie checkout. `400 validation_error` names who may not pay with these rules: `{ field: 'billing.address.country', rule: 'eu_person' }` for a person in another EU country, `{ field: 'billing.vat_id', rule: 'vat_id_required' }` for a company there with no VAT ID, `{ field: 'billing.vat_id', rule: 'vat_id_invalid' }` once VIES has said so, and `{ field: 'accept_withdrawal', rule: 'required' }` for a person who did not confirm it. `409 target_state_conflict` names `plan` with rule `already_billed` when the org already has an `active` or `past_due` billing account — checkout is for the first payment only, every later change is `POST /api/billing/change`. `checkout_url` is Mollie's hosted page; the return lands on `<console>/settings/billing?checkout=<checkout_id>`, which polls `GET /api/billing/checkout/:id` until the webhook — or the poll itself — has reconciled the payment. `409 plan_limit` is the org's own usage against the plan being bought."
|
|
6527
|
+
"notes": "Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/payment-method` and `POST /api/billing/invoices/:id/pay` — the three routes that mint a Mollie checkout. `400 validation_error` names who may not pay with these rules: `{ field: 'billing.address.country', rule: 'eu_person' }` for a person in another EU country, `{ field: 'billing.vat_id', rule: 'vat_id_required' }` for a company there with no VAT ID, `{ field: 'billing.vat_id', rule: 'vat_id_invalid' }` once VIES has said so, and `{ field: 'accept_withdrawal', rule: 'required' }` for a person who did not confirm it. `409 target_state_conflict` names `plan` with rule `already_billed` when the org already has an `active` or `past_due` billing account — checkout is for the first payment only, every later change is `POST /api/billing/change`. `checkout_url` is Mollie's hosted page, where the payer chooses card, PayPal or Apple Pay; the return lands on `<console>/settings/billing?checkout=<checkout_id>`, which polls `GET /api/billing/checkout/:id` until the webhook — or the poll itself — has reconciled the payment. `409 plan_limit` is the org's own usage against the plan being bought."
|
|
6528
6528
|
},
|
|
6529
6529
|
{
|
|
6530
6530
|
"method": "GET",
|
|
@@ -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` —
|
|
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 `first` payment on the existing Mollie customer
|
|
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
|
|
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'
|
|
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": [
|
|
@@ -537,23 +537,29 @@
|
|
|
537
537
|
"properties": {
|
|
538
538
|
"kind": {
|
|
539
539
|
"type": "string",
|
|
540
|
-
"const": "
|
|
541
|
-
"description": "A
|
|
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
542
|
},
|
|
543
|
-
"
|
|
543
|
+
"brand": {
|
|
544
544
|
"type": "string",
|
|
545
|
-
"description": "The
|
|
545
|
+
"description": "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'."
|
|
546
546
|
},
|
|
547
|
-
"
|
|
547
|
+
"last4": {
|
|
548
548
|
"type": "string",
|
|
549
|
-
"pattern": "
|
|
550
|
-
"description": "The last four
|
|
549
|
+
"pattern": "^\\d{4}$",
|
|
550
|
+
"description": "The last four digits of the card behind Apple Pay."
|
|
551
|
+
},
|
|
552
|
+
"expires": {
|
|
553
|
+
"type": "string",
|
|
554
|
+
"pattern": "^\\d{2}\\/\\d{2}$",
|
|
555
|
+
"description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
|
|
551
556
|
}
|
|
552
557
|
},
|
|
553
558
|
"required": [
|
|
554
559
|
"kind",
|
|
555
|
-
"
|
|
556
|
-
"
|
|
560
|
+
"brand",
|
|
561
|
+
"last4",
|
|
562
|
+
"expires"
|
|
557
563
|
],
|
|
558
564
|
"additionalProperties": false
|
|
559
565
|
},
|
|
@@ -584,6 +590,33 @@
|
|
|
584
590
|
],
|
|
585
591
|
"description": "The payment method on file, or `null`."
|
|
586
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."
|
|
606
|
+
},
|
|
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."
|
|
610
|
+
}
|
|
611
|
+
},
|
|
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
|
+
},
|
|
587
620
|
"invoices": {
|
|
588
621
|
"type": "array",
|
|
589
622
|
"items": {
|
|
@@ -668,6 +701,7 @@
|
|
|
668
701
|
"available",
|
|
669
702
|
"account",
|
|
670
703
|
"payment_method",
|
|
704
|
+
"payment_method_options",
|
|
671
705
|
"invoices"
|
|
672
706
|
],
|
|
673
707
|
"additionalProperties": false,
|
|
@@ -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'
|
|
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": [
|
|
@@ -534,23 +534,29 @@
|
|
|
534
534
|
"properties": {
|
|
535
535
|
"kind": {
|
|
536
536
|
"type": "string",
|
|
537
|
-
"const": "
|
|
538
|
-
"description": "A
|
|
537
|
+
"const": "applepay",
|
|
538
|
+
"description": "A card mandate from an Apple Pay first payment — Mollie stores it as `creditcard`; Fleetless labels it Apple Pay."
|
|
539
539
|
},
|
|
540
|
-
"
|
|
540
|
+
"brand": {
|
|
541
541
|
"type": "string",
|
|
542
|
-
"description": "The
|
|
542
|
+
"description": "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'."
|
|
543
543
|
},
|
|
544
|
-
"
|
|
544
|
+
"last4": {
|
|
545
545
|
"type": "string",
|
|
546
|
-
"pattern": "
|
|
547
|
-
"description": "The last four
|
|
546
|
+
"pattern": "^\\d{4}$",
|
|
547
|
+
"description": "The last four digits of the card behind Apple Pay."
|
|
548
|
+
},
|
|
549
|
+
"expires": {
|
|
550
|
+
"type": "string",
|
|
551
|
+
"pattern": "^\\d{2}\\/\\d{2}$",
|
|
552
|
+
"description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
|
|
548
553
|
}
|
|
549
554
|
},
|
|
550
555
|
"required": [
|
|
551
556
|
"kind",
|
|
552
|
-
"
|
|
553
|
-
"
|
|
557
|
+
"brand",
|
|
558
|
+
"last4",
|
|
559
|
+
"expires"
|
|
554
560
|
],
|
|
555
561
|
"additionalProperties": false
|
|
556
562
|
},
|
|
@@ -581,6 +587,33 @@
|
|
|
581
587
|
],
|
|
582
588
|
"description": "The payment method on file, or `null`."
|
|
583
589
|
},
|
|
590
|
+
"payment_method_options": {
|
|
591
|
+
"type": "array",
|
|
592
|
+
"items": {
|
|
593
|
+
"type": "object",
|
|
594
|
+
"properties": {
|
|
595
|
+
"method": {
|
|
596
|
+
"type": "string",
|
|
597
|
+
"enum": [
|
|
598
|
+
"card",
|
|
599
|
+
"paypal",
|
|
600
|
+
"applepay"
|
|
601
|
+
],
|
|
602
|
+
"description": "A method `POST /api/billing/payment-method` accepts now."
|
|
603
|
+
},
|
|
604
|
+
"pays_invoice": {
|
|
605
|
+
"type": "boolean",
|
|
606
|
+
"description": "Whether changing to it also pays the open invoice — `true` only for `applepay` when a zero-amount Apple Pay payment is not available."
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
"required": [
|
|
610
|
+
"method",
|
|
611
|
+
"pays_invoice"
|
|
612
|
+
],
|
|
613
|
+
"additionalProperties": false
|
|
614
|
+
},
|
|
615
|
+
"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."
|
|
616
|
+
},
|
|
584
617
|
"invoices": {
|
|
585
618
|
"type": "array",
|
|
586
619
|
"items": {
|
|
@@ -665,6 +698,7 @@
|
|
|
665
698
|
"available",
|
|
666
699
|
"account",
|
|
667
700
|
"payment_method",
|
|
701
|
+
"payment_method_options",
|
|
668
702
|
"invoices"
|
|
669
703
|
],
|
|
670
704
|
"additionalProperties": false
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
"enum": [
|
|
8
8
|
"card",
|
|
9
9
|
"paypal",
|
|
10
|
-
"
|
|
10
|
+
"applepay"
|
|
11
11
|
],
|
|
12
|
-
"description": "The new mandate's method. `
|
|
12
|
+
"description": "The new mandate's method. Offer what `billingView.payment_method_options` lists: `applepay` may be refused with `400 validation_error` `{ field: 'method', rule: 'applepay_needs_open_invoice' }` unless an invoice is open."
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"required": [
|
|
@@ -37,23 +37,29 @@
|
|
|
37
37
|
"properties": {
|
|
38
38
|
"kind": {
|
|
39
39
|
"type": "string",
|
|
40
|
-
"const": "
|
|
41
|
-
"description": "A
|
|
40
|
+
"const": "applepay",
|
|
41
|
+
"description": "A card mandate from an Apple Pay first payment — Mollie stores it as `creditcard`; Fleetless labels it Apple Pay."
|
|
42
42
|
},
|
|
43
|
-
"
|
|
43
|
+
"brand": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'."
|
|
46
|
+
},
|
|
47
|
+
"last4": {
|
|
44
48
|
"type": "string",
|
|
45
|
-
"
|
|
49
|
+
"pattern": "^\\d{4}$",
|
|
50
|
+
"description": "The last four digits of the card behind Apple Pay."
|
|
46
51
|
},
|
|
47
|
-
"
|
|
52
|
+
"expires": {
|
|
48
53
|
"type": "string",
|
|
49
|
-
"pattern": "
|
|
50
|
-
"description": "
|
|
54
|
+
"pattern": "^\\d{2}\\/\\d{2}$",
|
|
55
|
+
"description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
|
|
51
56
|
}
|
|
52
57
|
},
|
|
53
58
|
"required": [
|
|
54
59
|
"kind",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
60
|
+
"brand",
|
|
61
|
+
"last4",
|
|
62
|
+
"expires"
|
|
57
63
|
],
|
|
58
64
|
"additionalProperties": false
|
|
59
65
|
},
|
package/dist/billing.d.ts
CHANGED
|
@@ -376,12 +376,22 @@ export declare const billingDetailsUpdate: z.ZodObject<{
|
|
|
376
376
|
vat_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
377
377
|
}, z.core.$strict>;
|
|
378
378
|
export type BillingDetailsUpdate = z.infer<typeof billingDetailsUpdate>;
|
|
379
|
+
/**
|
|
380
|
+
* The payment methods Fleetless takes: card, PayPal and Apple Pay, in EUR and USD, and no others (André, 2026-10-04).
|
|
381
|
+
* Apple Pay is a Mollie method of its own at checkout and for a change, but the mandate it leaves is a card mandate.
|
|
382
|
+
*/
|
|
383
|
+
export declare const paymentMethodKind: z.ZodEnum<{
|
|
384
|
+
card: "card";
|
|
385
|
+
paypal: "paypal";
|
|
386
|
+
applepay: "applepay";
|
|
387
|
+
}>;
|
|
388
|
+
export type PaymentMethodKind = z.infer<typeof paymentMethodKind>;
|
|
379
389
|
/** `POST /api/billing/payment-method`'s body. */
|
|
380
390
|
export declare const paymentMethodChangeRequest: z.ZodObject<{
|
|
381
391
|
method: z.ZodEnum<{
|
|
382
392
|
card: "card";
|
|
383
393
|
paypal: "paypal";
|
|
384
|
-
|
|
394
|
+
applepay: "applepay";
|
|
385
395
|
}>;
|
|
386
396
|
}, z.core.$strict>;
|
|
387
397
|
export type PaymentMethodChangeRequest = z.infer<typeof paymentMethodChangeRequest>;
|
|
@@ -400,9 +410,10 @@ export declare const paymentMethod: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
400
410
|
last4: z.ZodString;
|
|
401
411
|
expires: z.ZodString;
|
|
402
412
|
}, z.core.$strip>, z.ZodObject<{
|
|
403
|
-
kind: z.ZodLiteral<"
|
|
404
|
-
|
|
405
|
-
|
|
413
|
+
kind: z.ZodLiteral<"applepay">;
|
|
414
|
+
brand: z.ZodString;
|
|
415
|
+
last4: z.ZodString;
|
|
416
|
+
expires: z.ZodString;
|
|
406
417
|
}, z.core.$strip>, z.ZodObject<{
|
|
407
418
|
kind: z.ZodLiteral<"paypal">;
|
|
408
419
|
account: z.ZodString;
|
|
@@ -616,13 +627,22 @@ export declare const billingView: z.ZodObject<{
|
|
|
616
627
|
last4: z.ZodString;
|
|
617
628
|
expires: z.ZodString;
|
|
618
629
|
}, z.core.$strip>, z.ZodObject<{
|
|
619
|
-
kind: z.ZodLiteral<"
|
|
620
|
-
|
|
621
|
-
|
|
630
|
+
kind: z.ZodLiteral<"applepay">;
|
|
631
|
+
brand: z.ZodString;
|
|
632
|
+
last4: z.ZodString;
|
|
633
|
+
expires: z.ZodString;
|
|
622
634
|
}, z.core.$strip>, z.ZodObject<{
|
|
623
635
|
kind: z.ZodLiteral<"paypal">;
|
|
624
636
|
account: z.ZodString;
|
|
625
637
|
}, z.core.$strip>], "kind">>;
|
|
638
|
+
payment_method_options: z.ZodArray<z.ZodObject<{
|
|
639
|
+
method: z.ZodEnum<{
|
|
640
|
+
card: "card";
|
|
641
|
+
paypal: "paypal";
|
|
642
|
+
applepay: "applepay";
|
|
643
|
+
}>;
|
|
644
|
+
pays_invoice: z.ZodBoolean;
|
|
645
|
+
}, z.core.$strip>>;
|
|
626
646
|
invoices: z.ZodArray<z.ZodObject<{
|
|
627
647
|
id: z.ZodUUID;
|
|
628
648
|
number: z.ZodString;
|
|
@@ -735,13 +755,22 @@ export declare const billingChangeResponse: z.ZodObject<{
|
|
|
735
755
|
last4: z.ZodString;
|
|
736
756
|
expires: z.ZodString;
|
|
737
757
|
}, z.core.$strip>, z.ZodObject<{
|
|
738
|
-
kind: z.ZodLiteral<"
|
|
739
|
-
|
|
740
|
-
|
|
758
|
+
kind: z.ZodLiteral<"applepay">;
|
|
759
|
+
brand: z.ZodString;
|
|
760
|
+
last4: z.ZodString;
|
|
761
|
+
expires: z.ZodString;
|
|
741
762
|
}, z.core.$strip>, z.ZodObject<{
|
|
742
763
|
kind: z.ZodLiteral<"paypal">;
|
|
743
764
|
account: z.ZodString;
|
|
744
765
|
}, z.core.$strip>], "kind">>;
|
|
766
|
+
payment_method_options: z.ZodArray<z.ZodObject<{
|
|
767
|
+
method: z.ZodEnum<{
|
|
768
|
+
card: "card";
|
|
769
|
+
paypal: "paypal";
|
|
770
|
+
applepay: "applepay";
|
|
771
|
+
}>;
|
|
772
|
+
pays_invoice: z.ZodBoolean;
|
|
773
|
+
}, z.core.$strip>>;
|
|
745
774
|
invoices: z.ZodArray<z.ZodObject<{
|
|
746
775
|
id: z.ZodUUID;
|
|
747
776
|
number: z.ZodString;
|
package/dist/billing.js
CHANGED
|
@@ -352,10 +352,16 @@ export const billingDetailsUpdate = z.object({
|
|
|
352
352
|
description: 'Replaces the VAT ID; `null` clears it. Omitted leaves it as it is. A new ID is re-checked through VIES.',
|
|
353
353
|
}),
|
|
354
354
|
}).strict();
|
|
355
|
+
/**
|
|
356
|
+
* The payment methods Fleetless takes: card, PayPal and Apple Pay, in EUR and USD, and no others (André, 2026-10-04).
|
|
357
|
+
* Apple Pay is a Mollie method of its own at checkout and for a change, but the mandate it leaves is a card mandate.
|
|
358
|
+
*/
|
|
359
|
+
export const paymentMethodKind = z.enum(['card', 'paypal', 'applepay']);
|
|
355
360
|
/** `POST /api/billing/payment-method`'s body. */
|
|
356
361
|
export const paymentMethodChangeRequest = z.object({
|
|
357
|
-
method:
|
|
358
|
-
description: "The new mandate's method. `
|
|
362
|
+
method: paymentMethodKind.meta({
|
|
363
|
+
description: "The new mandate's method. Offer what `billingView.payment_method_options` lists: `applepay` may be refused with " +
|
|
364
|
+
"`400 validation_error` `{ field: 'method', rule: 'applepay_needs_open_invoice' }` unless an invoice is open.",
|
|
359
365
|
}),
|
|
360
366
|
}).strict();
|
|
361
367
|
/** The billing account's own status, distinct from the org's plan: `billing_accounts` holds no plan, currency or period of its own. */
|
|
@@ -369,9 +375,10 @@ export const paymentMethod = z.discriminatedUnion('kind', [
|
|
|
369
375
|
expires: z.string().regex(/^\d{2}\/\d{2}$/).meta({ description: "Expiry as Mollie's mandate shows it, 'MM/YY'." }),
|
|
370
376
|
}),
|
|
371
377
|
z.object({
|
|
372
|
-
kind: z.literal('
|
|
373
|
-
|
|
374
|
-
|
|
378
|
+
kind: z.literal('applepay').meta({ description: "A card mandate from an Apple Pay first payment — Mollie stores it as `creditcard`; Fleetless labels it Apple Pay." }),
|
|
379
|
+
brand: z.string().meta({ description: "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'." }),
|
|
380
|
+
last4: z.string().regex(/^\d{4}$/).meta({ description: 'The last four digits of the card behind Apple Pay.' }),
|
|
381
|
+
expires: z.string().regex(/^\d{2}\/\d{2}$/).meta({ description: "Expiry as Mollie's mandate shows it, 'MM/YY'." }),
|
|
375
382
|
}),
|
|
376
383
|
z.object({
|
|
377
384
|
kind: z.literal('paypal').meta({ description: 'A PayPal mandate.' }),
|
|
@@ -424,21 +431,37 @@ export const billingAccount = z.object({
|
|
|
424
431
|
addons: orgAddons.nullable().meta({ description: "Add-on counts queued for the period's end, or `null`." }),
|
|
425
432
|
}).meta({ description: "What takes effect at the period's end." }),
|
|
426
433
|
dunning: z.object({
|
|
427
|
-
invoice_id: z.uuid().meta({
|
|
428
|
-
|
|
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
|
+
}),
|
|
429
441
|
due_at: z.iso.datetime().meta({ description: "The charge's due date; retries and the lock count from here." }),
|
|
430
|
-
next_retry_at: z.iso.datetime().nullable().meta({
|
|
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
|
+
}),
|
|
431
446
|
lock_at: z.iso.datetime().meta({ description: 'When the org is locked if still unpaid (`BILLING_LOCK_DAY`).' }),
|
|
432
447
|
failure: z.string().nullable().meta({
|
|
433
|
-
description: "Mollie's own reason, e.g. 'card_expired'; 'vat_id_invalid'
|
|
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.",
|
|
434
450
|
}),
|
|
435
|
-
}).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.' }),
|
|
436
452
|
});
|
|
437
453
|
/** `GET /api/billing`'s answer, and what every other billing route hands back after a change. */
|
|
438
454
|
export const billingView = z.object({
|
|
439
455
|
available: z.boolean().meta({ description: 'Whether this cloud takes payments at all — `false` when no Mollie key is configured.' }),
|
|
440
456
|
account: billingAccount.nullable().meta({ description: '`null` before the org has ever checked out.' }),
|
|
441
457
|
payment_method: paymentMethod.nullable().meta({ description: 'The payment method on file, or `null`.' }),
|
|
458
|
+
payment_method_options: z.array(z.object({
|
|
459
|
+
method: paymentMethodKind.meta({ description: 'A method `POST /api/billing/payment-method` accepts now.' }),
|
|
460
|
+
pays_invoice: z.boolean().meta({ description: 'Whether changing to it also pays the open invoice — `true` only for `applepay` when a zero-amount Apple Pay payment is not available.' }),
|
|
461
|
+
})).meta({
|
|
462
|
+
description: 'What a payment-method change may offer right now, so a client offers exactly what the cloud accepts. `applepay` is absent when ' +
|
|
463
|
+
'it needs an open invoice and none is open; `[]` when the org has no billing account.',
|
|
464
|
+
}),
|
|
442
465
|
invoices: z.array(billingInvoice).meta({ description: 'Newest first, at most 24.' }),
|
|
443
466
|
});
|
|
444
467
|
/** `POST /api/billing/change`'s answer: the billing view afterwards, and what was charged right now, if anything. */
|
package/dist/index.d.ts
CHANGED
|
@@ -57,5 +57,5 @@ export { planId, PLAN_ORDER, planLimitKey, planLimits, planFeature, planFeatures
|
|
|
57
57
|
export type { PlanId, PlanLimitKey, PlanLimits, PlanFeature, PlanFeatures, PlanPrices, PlanSupport, PlanCatalogueEntry, AddonKey, AddonCatalogueEntry, } from './plans.js';
|
|
58
58
|
export { planCurrency, orgAddons, orgPlanUsage, planChangeKeep, planChangeReason, pendingPlanChange, orgLock, orgPlan, planChangeRequest, planOverrides, adminPlanChangeRequest, } from './plans.js';
|
|
59
59
|
export type { PlanCurrency, OrgAddons, OrgPlanUsage, PlanChangeKeep, PlanChangeReason, PendingPlanChange, OrgLock, OrgPlan, PlanChangeRequest, PlanOverrides, AdminPlanChangeRequest, } from './plans.js';
|
|
60
|
-
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingAccount, billingView, billingChangeResponse, } from './billing.js';
|
|
61
|
-
export type { PayerKind, BillingCycle, VatTreatment, PayerRefusalRule, VatDecision, ChargeAmounts, BillingState, QuoteLine, CheckoutQuote, BillingAddress, BillingDetails, CheckoutRequest, CheckoutResponse, CheckoutStatus, VatIdStatus, VatIdCheckRequest, VatIdCheckResponse, BillingChangeRequest, BillingCancelRequest, BillingDetailsUpdate, PaymentMethodChangeRequest, BillingAccountStatus, PaymentMethod, InvoiceStatus, BillingInvoice, BillingAccount, BillingView, BillingChangeResponse, } from './billing.js';
|
|
60
|
+
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingAccount, billingView, billingChangeResponse, } from './billing.js';
|
|
61
|
+
export type { PayerKind, BillingCycle, VatTreatment, PayerRefusalRule, VatDecision, ChargeAmounts, BillingState, QuoteLine, CheckoutQuote, BillingAddress, BillingDetails, CheckoutRequest, CheckoutResponse, CheckoutStatus, VatIdStatus, VatIdCheckRequest, VatIdCheckResponse, BillingChangeRequest, BillingCancelRequest, BillingDetailsUpdate, PaymentMethodKind, PaymentMethodChangeRequest, BillingAccountStatus, PaymentMethod, InvoiceStatus, BillingInvoice, BillingAccount, BillingView, BillingChangeResponse, } from './billing.js';
|
package/dist/index.js
CHANGED
|
@@ -70,4 +70,4 @@ export { planId, PLAN_ORDER, planLimitKey, planLimits, planFeature, planFeatures
|
|
|
70
70
|
// admin request (I-2).
|
|
71
71
|
export { planCurrency, orgAddons, orgPlanUsage, planChangeKeep, planChangeReason, pendingPlanChange, orgLock, orgPlan, planChangeRequest, planOverrides, adminPlanChangeRequest, } from './plans.js';
|
|
72
72
|
// 2026-10-04 — billing through Mollie (#104).
|
|
73
|
-
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingAccount, billingView, billingChangeResponse, } from './billing.js';
|
|
73
|
+
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingAccount, billingView, billingChangeResponse, } from './billing.js';
|
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` (
|
|
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',
|
|
@@ -2898,7 +2898,8 @@ export const ROUTES = [
|
|
|
2898
2898
|
'`{ field: \'billing.vat_id\', rule: \'vat_id_invalid\' }` once VIES has said so, and ' +
|
|
2899
2899
|
'`{ field: \'accept_withdrawal\', rule: \'required\' }` for a person who did not confirm it. `409 target_state_conflict` names ' +
|
|
2900
2900
|
'`plan` with rule `already_billed` when the org already has an `active` or `past_due` billing account — checkout is for the first ' +
|
|
2901
|
-
'payment only, every later change is `POST /api/billing/change`. `checkout_url` is Mollie\'s hosted page
|
|
2901
|
+
'payment only, every later change is `POST /api/billing/change`. `checkout_url` is Mollie\'s hosted page, where the payer ' +
|
|
2902
|
+
'chooses card, PayPal or Apple Pay; the return lands on ' +
|
|
2902
2903
|
'`<console>/settings/billing?checkout=<checkout_id>`, which polls `GET /api/billing/checkout/:id` until the webhook — or the poll ' +
|
|
2903
2904
|
'itself — has reconciled the payment. `409 plan_limit` is the org\'s own usage against the plan being bought.',
|
|
2904
2905
|
},
|
|
@@ -2945,10 +2946,11 @@ export const ROUTES = [
|
|
|
2945
2946
|
notes: 'The body names the **absolute** target — plan, cycle and add-ons — never a delta: the route compares it with the ' +
|
|
2946
2947
|
'org\'s current state and splits the difference. The increasing part is charged now, through the same proration `changeNetCents` ' +
|
|
2947
2948
|
'computes, and takes effect the moment Mollie accepts the `recurring` payment with anything but `failed`, `canceled` or `expired` ' +
|
|
2948
|
-
'—
|
|
2949
|
+
'— card mandates, Apple Pay\'s included, usually answer `paid` within seconds, a PayPal one may stay `pending` for a while; if it ' +
|
|
2950
|
+
'fails later, its open invoice enters dunning like a failed renewal. If Mollie refuses or does not answer, nothing is applied ' +
|
|
2949
2951
|
'and this answers `502 payment_provider_unavailable` instead. The decreasing part — a lower plan, yearly → monthly, fewer add-ons — ' +
|
|
2950
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 ' +
|
|
2951
|
-
'limits answers `409 plan_limit` and the console opens
|
|
2953
|
+
'limits answers `409 plan_limit` and the console opens its choose-what-stays page. Any increase first withdraws a pending ' +
|
|
2952
2954
|
'downgrade or cancel, exactly as the admin route does. `409 target_state_conflict` names `billing` with rule `no_account` (no ' +
|
|
2953
2955
|
'checkout yet — use `POST /api/billing/checkout`), `past_due` (an open invoice has to be paid first) or `no_valid_mandate` (the ' +
|
|
2954
2956
|
'payment method needs renewing first, `POST /api/billing/payment-method`). `charged` in the response is the invoice from the part ' +
|
|
@@ -2961,12 +2963,18 @@ export const ROUTES = [
|
|
|
2961
2963
|
params: [], query: null, request: paymentMethodChangeRequest, response: checkoutResponse,
|
|
2962
2964
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
|
|
2963
2965
|
transport: 'http',
|
|
2964
|
-
notes: 'Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. Creates a `first` payment on the
|
|
2965
|
-
'Mollie customer
|
|
2966
|
-
'
|
|
2967
|
-
'
|
|
2968
|
-
'
|
|
2969
|
-
'
|
|
2966
|
+
notes: 'Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. Creates a hosted `first` payment on the ' +
|
|
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 — 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 ' +
|
|
2972
|
+
'same where Mollie accepts a zero-amount Apple Pay payment; where it does not, a change to Apple Pay is only offered together ' +
|
|
2973
|
+
'with paying an open invoice — the payment is then that invoice\'s amount and pays it — and without one this answers ' +
|
|
2974
|
+
'`400 validation_error` with `{ field: \'method\', rule: \'applepay_needs_open_invoice\' }`. A client offers what ' +
|
|
2975
|
+
'`payment_method_options` in `GET /api/billing` lists. `404 not_found` when the org has no billing account yet. When the new ' +
|
|
2976
|
+
'mandate turns `valid` it becomes the account\'s — an Apple Pay one is a card mandate, shown as `applepay` — and every other ' +
|
|
2977
|
+
'mandate of the customer is revoked.',
|
|
2970
2978
|
},
|
|
2971
2979
|
{
|
|
2972
2980
|
method: 'POST', path: '/api/billing/cancel', section: 'billing',
|
|
@@ -2976,7 +2984,7 @@ export const ROUTES = [
|
|
|
2976
2984
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'plan_limit'], transport: 'http',
|
|
2977
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 ' +
|
|
2978
2986
|
'cancel. Takes effect at the period\'s end, nothing credited or refunded; over Basic\'s limits this is refused `409 ' +
|
|
2979
|
-
'plan_limit` and the console sends the owner to
|
|
2987
|
+
'plan_limit` and the console sends the owner to its choose-what-stays page instead, the same as a plan downgrade. "Cancel at ' +
|
|
2980
2988
|
'period end" is not a flag here — it reads as `pending_change.target_plan === \'basic\'` on `GET /api/org/plan`.',
|
|
2981
2989
|
},
|
|
2982
2990
|
{
|
|
@@ -3001,14 +3009,18 @@ export const ROUTES = [
|
|
|
3001
3009
|
method: 'POST', path: '/api/billing/invoices/:id/pay', section: 'billing',
|
|
3002
3010
|
summary: 'Pays one open invoice, through a new Mollie payment.',
|
|
3003
3011
|
audience: 'developer', auth: 'developer', rateLimited: true, ownerTier: true, status: 201,
|
|
3004
|
-
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`.' }],
|
|
3005
3013
|
query: null, request: null, response: checkoutResponse,
|
|
3006
3014
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'not_found', 'target_state_conflict', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
|
|
3007
3015
|
transport: 'http',
|
|
3008
3016
|
notes: 'Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. `409 target_state_conflict` names `invoice` ' +
|
|
3009
3017
|
'with rule `not_open` when the invoice is already `paid` or `uncollectible` — there is nothing left to pay. Paying the open ' +
|
|
3010
3018
|
'invoice of a locked org unlocks it and keeps the plan running to the period\'s end, the same as a renewal that ' +
|
|
3011
|
-
'succeeds on a retry. `
|
|
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.',
|
|
3012
3024
|
},
|
|
3013
3025
|
{
|
|
3014
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
|
+
"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",
|