Skip to content

Subscriptions & billing

A tenant’s plan determines its features and monthly document quota. Subscriptions are tenant-level and environment-independent. Only production emissions consume quota — sandbox is always free.

Two plan ladders, chosen by identification type

Section titled “Two plan ladders, chosen by identification type”

The catalog is split in two. The pf_* plans are for a persona física and are sold only to holders of a cédula física (01) or DIMEX (03); the pj_* plans are for a persona jurídica and are open to every identification type. A plan code is stable and never carries the commercial name, so a rebrand never changes what is stored on a subscription.

Ventana de terminal
GET /v1/billing/plans # public catalog; ?track=pf|pj to filter
GET /v1/billing/plans/available # only what THIS tenant may buy

GET /v1/billing/plans is public — it is the pricing page’s source. Each entry carries both the net price and the gross actually charged to the card, so no client has to know the tax rate. GET /v1/billing/plans/available narrows the catalog to the ladders the tenant may buy from, derived on the server from its Hacienda identification type: tracks is ['pf', 'pj'] for a cédula física or a DIMEX (both ladders, each plan tagged with its track; track is the recommended one, pf) and ['pj'] for every other identification type. The ?track= a client passes to the public endpoint is a display choice, not an entitlement.

Asking for a plan the tenant’s identification type does not allow fails with PLAN_NOT_AVAILABLE_FOR_IDENTIFICATION_TYPE. The check runs before anything is written, so a rejected request leaves no scheduled change behind and creates nothing in Onvo. GET /v1/auth/me returns identificationType and the derived planTrack, so a client can explain the restriction rather than only report it.

Entitlements — the axis that matters at runtime

Section titled “Entitlements — the axis that matters at runtime”
Ventana de terminal
GET /v1/billing/entitlements

Returns the resolved plan: tier, feature set, quota, and current usage (including prepaidBalance). Entitlements are a separate axis from RBAC scopes — a gated write must pass both (does the plan include the feature and does the credential have the scope).

paymentRecovery (retrying | suspended | null) says whether there is a failed renewal to recover from. Key the “reactivate” prompt on it and not on status: status describes the plan being served, and a tenant with prepaid credits reads active while its subscription is unpaid.

Read limits.documentsRegime before rendering a quota, because limits.documentsPerPeriod is null in every regime but quota (three of them in the entitlements, and a fourth that only the catalog reports):

documentsRegime What it means
quota documentsPerPeriod holds the monthly allowance.
unlimited No cap and no per-document charge, subject to the fair-use terms.
metered No cap; every document is billable (the pay-per-use regime, «Por consumo»).
external The cap is the prepaid credit balance, not a period quota.
quoted The plan is sold by quote (Águila, Jaguar): the allowance is the accepted quote’s. Only the catalog reports it (GET /v1/billing/plans and GET /v1/billing/plans/available) — a tenant on such a plan reads quota or unlimited from its quote, and quote carries the terms.

Document emission consumes the monthly subscription quota first, then prepaid credit lots as overage once the quota is exhausted. A subscriber who also bought prepaid bundles keeps their subscription features and uses the bundles only as extra capacity — buying prepaid never downgrades them.

A tenant with no good-standing subscription but a positive prepaid balance is treated as the entry tier (Prepago) for as long as the balance lasts.

Ventana de terminal
GET /v1/billing/plan-change/preview # read-only: what this change would do
POST /v1/billing/plan-change # upgrade / downgrade / interval switch
POST /v1/billing/plan-change/sync # complete an upgrade after its intent was paid
POST /v1/billing/cancel # cancel at period end
POST /v1/billing/resume
POST /v1/billing/cancel-scheduled-change
POST /v1/billing/recovery # recover from a failed renewal
  • Upgrade can take effect now or at the period end (timing: 'now' | 'period_end'). A change counts as an upgrade only when the target plan is at least as good on all four axes — price, document allowance, seats and features. That test replaces a single tier number, which two ladders made meaningless.
  • Upgrading now over a live plan credits the plan being left. The whole days that remain to the running plan’s next anniversary — counted in the interval of the price being bought — are priced at the new plan’s daily price (listChargeCentimos), and the unused whole days of the plan being left, at its own list price, are credited against them in the same operation (creditCentimos, creditDays, creditPlanCode). It is not a balance: whatever the credit does not cover is paid, whatever exceeds it buys extraDays of the new plan, and nothing is ever left over.
    • When a card has something to pay, the answer is mode: 'checkout' with paymentType: 'one_time' and a paymentIntentId: a payment intent for the difference (the days minus the credit). The amount is fixed on the intent (firstChargeCentimos, with firstChargeNetCentimos for the tax breakdown) and is the same figure the preview quotes. Render the Onvo SDK with paymentType: 'one_time'; when the SDK confirms it, call POST /v1/billing/plan-change/sync with the paymentIntentId. That completion creates the subscription that renews the plan with a trial of exactly the days paid — so its first invoice is the full price, from proratedTo — makes the plan effective and retires the one it replaces. It is idempotent and the same completion the payment webhook and the reconcile run, so a lost call never leaves money in and no plan out. Its answer is active once the plan is on, the intent’s own status while the payment is still settling, or processing while a concurrent completion of the same intent is running; PLAN_UPGRADE_NEEDS_REVIEW (400) means the money is in but a person has to finish the change — do not pay again. Our comprobante for the charge shows the days at the list price with the credit as a discount line.
    • When the credit covers the days (an annual plan moving to a monthly price) or the difference is under the minimum charge, the answer is mode: 'applied': the plan is already on, with a trial of trialDays (the days to the anniversary plus the days the surplus credit bought), paid through paidThrough, renewing at renewalCentimos from then on. No SDK, nothing to pay, no comprobante (nothing was collected).
    • Send expectedChargeCentimos — the quote.chargeCentimos you showed — and a quote that moved in between (a day boundary) answers 409 PLAN_UPGRADE_QUOTE_CHANGED instead of charging a figure nobody saw.
  • A fresh subscribe (no live plan) answers paymentType: 'subscription' with a subscriptionId: a plain subscription at the full price whose cycle starts today; call POST /v1/billing/subscription/sync on success.
  • Preview first. GET /v1/billing/plan-change/preview writes nothing (it reads the running subscription from Onvo once) and answers what a client needs before asking the user anything: whether the change is an upgrade, when the paid period ends (effectiveAt), the instant an immediate upgrade is paid through (proratedTo — as far as the days served reach, which with a surplus credit can be months past the anniversary), which add-ons the target plan would cover, and the quote of upgrading now: chargeCentimos (what the card pays), chargeNetCentimos, listChargeCentimos, creditCentimos, creditDays, creditPeriodDays, creditPlanCode, creditInterval, days, periodDays, extraDays, trialDays, anniversary, paidThrough, renewalCentimos and waived. Do not classify the change on the client. planCode must be a self-service plan (PLAN_NOT_SELECTABLE otherwise) and interval, when sent, month or year (BILLING_INTERVAL_INVALID). The dates and the quote are null when the period end could not be established — offer no timing choice then. When the quote is waived (the difference is under the minimum charge), asking for now applies the plan on the spot (mode: 'applied') and nothing is charged.
  • A checkout does not stay payable forever. An upgrade’s intent carries expiresAt (one hour): its days were counted from today, so do not leave the Onvo SDK payable past it — start the change again. A subscription checkout paid on a subscription older than the one on record answers SUBSCRIPTION_SUPERSEDED.
  • Anything else is scheduled for the period end, including a lateral move between ladders that trades documents for seats. Nobody loses access by being scheduled: the current plan runs to the end of the period already paid for, and charging today would mean cancelling and recreating the subscription, throwing those paid days away.
  • Interval switch on the same plan (monthly ↔ annual) is always scheduled.
  • Cancel is cancel-at-period-end — features survive until currentPeriodEnd. The exception is a subscription already suspended for non-payment: there is no paid period left to run out, so cancelling ends it immediately and the card stops being retried.
  • An active contract plan can’t self-serve change (PLAN_CHANGE_CONTACT_SALES).
  • A contract plan is asked for with POST /v1/billing/plan-requests (expected volume, people, contact, needs); GET /v1/billing/plan-requests lists the company’s requests and POST /v1/billing/plan-requests/:id/withdraw takes an open one back. One open request at a time (409 PLAN_REQUEST_ALREADY_OPEN), a few per day (429).
  • The EmiteCR team answers with a quote. GET /v1/billing/quotes lists the company’s quotes, GET /v1/billing/quotes/:id/document returns a quote’s document exactly as it was sent, and POST /v1/billing/quotes/:id/accept accepts it. Accepting binds the company, so it takes both billing:manage and legal:accept, and the body carries the same declaration as accepting the Terms: authority: true (false answers 400 LEGAL_AUTHORITY_REQUIRED) and the capacity it is made in, holder, legal_representative or authorized (any other value answers 400 LEGAL_CAPACITY_REQUIRED). With no live plan, or one in dunning, the answer is a checkout at the quote’s price (mode: 'checkout', paymentType: 'subscription'; call POST /v1/billing/subscription/sync once it is paid), and the quote becomes accepted when the payment is verified; over a live list plan the change is scheduled for the period end (mode: 'scheduled'). A quote that can no longer be accepted answers 409 QUOTE_EXPIRED or QUOTE_NOT_OPEN.
  • A quote may carry a minimum term: while it binds, POST /v1/billing/cancel answers 409 PLAN_COMMITMENT_ACTIVE with the date, and quote.commitmentActive in the entitlements says so beforehand. An annual quoted plan is told 30 days before it renews.

When paymentRecovery is set, POST /v1/billing/recovery opens the way back. It answers one of two things:

mode What happened What to do
checkout A new subscription to the plan the tenant had was created, unpaid. Render the Onvo SDK with the returned ids, then call POST /v1/billing/subscription/sync with its subscriptionId.
recovered The charge had already been collected — by the gateway’s own retry, or by a checkout paid earlier — and the plan was restored. Nothing to pay. Re-read the entitlements.

Recovery never charges the subscription that failed a second time. The new one is charged the full price of the period (firstChargeCentimos), its period starts the day it is paid, and confirming it retires the failed subscription, which is what stops its retries. No paid day is lost to the new period: a renewal is attempted when the paid period ends, so service already paid for had run out.

A recovery checkout carries expiresAt (one hour after it was opened). The failed subscription keeps being retried until the new one is paid, so do not leave the Onvo SDK payable past that instant — ask for a new one. Choosing a plan with POST /v1/billing/plan-change while paymentRecovery is set is a recovery too, and its response carries the same expiresAt.

Error When
NOTHING_TO_RECOVER The subscription is not past_due or unpaid.
RECOVERY_PLAN_UNAVAILABLE The plan cannot be sold again: it is neither a self-service plan (a retired code counts as the plan that replaced it) nor a quoted plan with its quote still in force — a quoted plan, Águila or Jaguar, is sold again on that quote. Offer the available plans instead.
Ventana de terminal
GET /v1/billing/addon-quote?addon=audit|whatsapp # what switching it on would charge
POST /v1/billing/audit-addon # { enabled, expectedChargeCentimos? }
POST /v1/billing/whatsapp-agent-addon # { enabled, expectedChargeCentimos? }

An add-on rides on a subscription: it needs a plan in good standing and a saved card. The entitlements say what there is to offer — addonsCoveredByPlan lists the add-ons the plan already includes (nothing to sell), and addons carries the lifecycle of the ones the tenant holds.

Switching one on charges the saved card in that same request — there is no checkout in between — so ask for the quote first and show it:

Field Meaning
chargeCentimos What the card is charged now, IVA included: the whole days left to the plan’s next monthly anniversary. 0 when waived.
chargeNetCentimos The base of that charge. The IVA is the remainder.
days / periodDays Days being bought, out of the days of the plan’s current monthly window.
paidThrough When those days run out — the add-on’s first renewal.
renewalCentimos What every renewal charges: a full month, IVA included.
waived The days cost less than the minimum charge, so they are not charged.

Send chargeCentimos back as expectedChargeCentimos when enabling. If the purchase would charge any other amount — the quote moves when a day boundary is crossed — it is refused with ADDON_QUOTE_CHANGED and nothing is collected; ask for the quote again. From paidThrough on, the add-on renews every month at renewalCentimos.

Switching one off stops the renewal, not the service: the add-on stays available until the end of the period already paid for, and switching it back on inside that period charges nothing. It can be switched off whatever state the plan is in, including suspended.

Error When
NO_ACTIVE_SUBSCRIPTION There is no plan in good standing to attach it to.
ADDON_REQUIRES_SUBSCRIPTION The tenant is on prepaid credits, with no subscription.
ADDON_ALREADY_INCLUDED The plan already includes the feature.
NO_PAYMENT_METHOD_ON_FILE There is no usable saved card.
ADDON_QUOTE_CHANGED expectedChargeCentimos is no longer what would be charged.
ADDON_PAYMENT_FAILED The card declined. Nothing was charged and the add-on is off.
ADDON_PURCHASE_IN_PROGRESS An earlier purchase of this add-on is still settling. Retry in a few minutes — it is never charged twice.
ADDON_UNKNOWN The addon query parameter is not audit or whatsapp.
Ventana de terminal
POST /v1/billing/prepaid # start a one-time purchase
POST /v1/billing/prepaid/sync # confirm after the embedded payment
GET /v1/billing/prepaid-lots
GET /v1/billing/payments

Prepaid lots are minted idempotently on confirmed payment and expire on a schedule (with reminder emails). They’re consumed as overage per the quota model above. A lot with granted set to true was a courtesy from the EmiteCR team: it carried no charge, and otherwise works the same.

POST /v1/billing/prepaid hands back the open intent of the same bundle for an hour (a refresh, a double click) instead of minting another. A SINPE Móvil is asynchronous: once the buyer presses «Continuar» in the SDK the intent reads processing until the transfer lands, Onvo refuses a card on it, and a new checkout mints a fresh intent. When the buyer already started one for this bundle within the last 24 hours, the answer also carries pendingPayment (paymentIntentId, startedAt): tell them to wait if they sent the transfer — the payment-intent.succeeded webhook credits the lot when it lands — instead of letting them pay the same bundle again. The same field rides on the one_time answer of POST /v1/billing/plan-change.

Payments run through Onvo Pay (Costa Rican gateway). Card data is collected by Onvo’s embedded SDK iframe and tokenized — EmiteCR only ever handles opaque ids, never card numbers. You don’t build a card form.

Demo tenants are blocked from checkout (BILLING_NOT_AVAILABLE_IN_DEMO).