OpenRCS API reference · v1 ← Back to console Swagger UI
Accounts

Create a payment session to top up the wallet

POST /account/topup bearer_auth

Creates a payment session to top up the wallet. `amount_eur` is **tax-excluded (HT)**: checkout charges HT+VAT at the deployment VAT rate (a 10€ top-up charges 12€ at 20%). The wallet is credited the **tax-excluded amount** — it is **not** mutated here; the credit is written once, idempotently, when the payment provider confirms the payment (the HT amount travels in the session metadata). On success the response returns the `checkout_url` to redirect the user to. `amount_eur` is a bounded positive integer (1–10000). Gated to `status: ready` and requires the invoice-grade `company` block to be fully set (every `company` field present and non-blank); an incomplete company block is rejected with a `400` that points to `PATCH /account`. Top-ups and payment crediting run regardless of whether billing is enabled; only message sending is gated.

Parameters

NameInTypeRequiredDescription
Authorization header string yes `Bearer <token>` obtained from `POST /login`.

Request body

FieldTypeRequiredDescription
amount_eur integer yes Top-up amount in whole euros (1–10000), tax-excluded: the checkout charge applies VAT on top (10€ → 12€ at 20%) and the wallet is credited the tax-excluded amount.
success_url string no Optional https URL the browser is returned to after a successful payment (e.g. your billing page with a `?topup=success` marker). Any https host is accepted; non-https or oversized values are rejected with a `400`.
cancel_url string no Optional https URL the browser is returned to when the payment is cancelled. Same rules as `success_url`.
{
  "amount_eur": 60
}

Responses

StatusDescription
200 Payment session created.
400 Missing, non-integer, or out-of-range `amount_eur`, company info not fully set (all `company` fields required before a top-up; update them via `PATCH /account`), or an invalid `success_url`/`cancel_url` (must be https with a host, ≤2048 chars).
401 Missing or invalid credentials.
404 Account not found.
409 Account is not ready yet (`status` is not `ready`).
502 Upstream payment call failed; a generic error is returned and no internals are leaked.

200 example

{
  "checkout_url": "https://pay.example.com/c/cs_123",
  "session_id": "cs_123"
}