Accept a plan quote («Contratar»)
const url = 'https://api.emite.cr/v1/billing/quotes/example/accept';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"authority":true,"capacity":"holder"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.emite.cr/v1/billing/quotes/example/accept \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "authority": true, "capacity": "holder" }'Requires BOTH billing:manage and legal:accept: accepting a quote binds the company to its terms, as accepting the Terms does. The body carries the same declaration — authority (true) and the capacity it is made in — which is recorded on the quote with the IP and the browser. With no live subscription, or one in dunning, the answer is mode='checkout' with paymentType='subscription': render the Onvo SDK with the returned ids and call /billing/subscription/sync on success; the quote becomes accepted when the money is in, and expiresAt is the quote's validity. Over a LIVE list plan the answer is mode='scheduled': the change is enacted at the period end with the saved card, and the quote waits as scheduled. 409 QUOTE_EXPIRED / QUOTE_NOT_OPEN when it cannot be accepted today; 404 QUOTE_NOT_FOUND for a quote that is not this company's.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
The declaration that the person has the authority to bind the company to the quote — the same declaration the company makes when it accepts the Terms. Must be true: false answers 400 LEGAL_AUTHORITY_REQUIRED, and a missing or non-boolean value 400 VALIDATION_ERROR.
In which capacity the declaration is made: the holder of the cédula, the legal representative, or a person they authorized. Recorded on the quote with the acceptance.
Responses
Section titled “Responses”object
'checkout' → a subscription at the quote's price, paid in the Onvo SDK with the returned ids (paymentType='subscription'); call /billing/subscription/sync on success — the quote becomes accepted when the money is in. 'scheduled' → the company has a live list plan: the change is enacted at the period end with the saved card, nothing is charged now, and the quote waits as scheduled.
The quote accepted.
The quoted plan (pf_custom Águila, pj_custom Jaguar).
The quote's cadence.
What the Onvo SDK confirms (checkout mode only): always subscription, a subscription at the quote's price. Absent in scheduled mode, where nothing is paid now.
Onvo subscription id to pay (checkout mode).
Onvo customer id (checkout mode).
Onvo publishable key for the SDK (checkout mode).
What the card will be charged, in céntimos (checkout mode): the quote's fee for one period, IVA included, read back from the subscription Onvo created.
Base imponible of that charge, in céntimos (checkout mode). The IVA is the remainder.
ISO instant past which the checkout must not be paid (checkout mode): the quote's validity — or the recovery window, when the quote is accepted over a plan in dunning and that ends first. Past it the acceptance is late and the payment is refused.
ISO instant the scheduled change applies (scheduled mode) — the current period end.
Example
{ "mode": "checkout", "interval": "month", "paymentType": "subscription"}