API / Billing
POST
/billing/upgrade
Upgrade to a larger plan
Moves the tenant to a larger tier, effective immediately. The prorated difference is charged on the existing mandate BEFORE the tier is applied: a declined charge leaves the tier untouched. Requires explicit consent to the amount returned by the quote endpoint.
Authentification : clé API Bearer requise.
Corps JSON
Target plan and accepted amount
| Nom | Type | Description |
|---|---|---|
| acceptedCents | integer | AcceptedCents is the prorated amount the customer agreed to, from a prior quote. It is verified against a freshly computed amount: a stale quote must not authorise a different charge. |
| consented | boolean | Consented records that the amount was shown and agreed to. Required for any charge above the proration floor. |
| plan | string | Plan is the larger tier to move to. |
Exemple curl
curl -X POST https://api.sporee.fr/billing/upgrade \
-H "Authorization: Bearer $SPORE_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'Réponses
| Statut | Description | Type |
|---|---|---|
| 200 | OK | upgrade_subscription.Result |
| 400 | Bad Request | echo.HTTPError |
| 401 | Unauthorized | echo.HTTPError |
| 402 | the payment was declined | echo.HTTPError |
| 404 | no subscription — open a checkout instead | echo.HTTPError |
| 409 | the quoted amount was not consented to | echo.HTTPError |
| 422 | not an upgrade, or the subscription cannot change tier | echo.HTTPError |
| 503 | billing is not configured | echo.HTTPError |
Source machine : openapi.json · opération upgradeBillingSubscription