Skip to content

Recover from a failed renewal

POST
/v1/billing/recovery
curl --request POST \
--url https://api.emite.cr/v1/billing/recovery \
--header 'Authorization: Bearer <token>'

For a subscription in past_due or unpaid (paymentRecovery in the entitlements). Recovery is a NEW subscription to the same plan, paid in the Onvo SDK, whose period starts today; confirming it retires the one that failed, which stops its retries. The failed subscription is never charged again by this flow. The server looks before it sells: if the charge had already been collected (Onvo's own retry, or a checkout paid earlier), the plan is restored and the response is mode='recovered'. 400 NOTHING_TO_RECOVER when the subscription is not in dunning; 400 RECOVERY_PLAN_UNAVAILABLE when its plan has no checkout: neither a self-service plan nor a quoted plan with its quote in force (a quoted plan is sold again on that quote). The card is collected by the Onvo iframe — never our servers.

Media typeapplication/json
object
mode
required

'checkout' → a NEW subscription to the plan whose payment failed; render the Onvo SDK with the returned ids and call /subscription/sync on success. 'recovered' → nothing to pay: the charge had already been collected and the plan was restored.

string
Allowed values: checkout recovered
planCode

Plan being bought again (checkout mode).

string
interval

Its cadence (checkout mode).

string
Allowed values: month year
paymentType

Always subscription here: a recovery is a plain subscription paid in the Onvo SDK.

string
Allowed values: subscription
subscriptionId

Onvo subscription id to pay (checkout mode).

string
customerId

Onvo customer id (checkout mode).

string
publishableKey

Onvo publishable key for the SDK (checkout mode).

string
firstChargeCentimos

What the card will be charged, in céntimos (checkout mode) — the full price of the period, read back from the subscription Onvo created. Absent when Onvo did not report it.

number
firstChargeNetCentimos

Base imponible of that charge, in céntimos (checkout mode). The IVA is the remainder.

number
expiresAt

ISO instant past which the checkout must not be paid (checkout mode). Onvo keeps retrying the subscription being recovered from, so an old checkout risks collecting both.

string
Example
{
"mode": "checkout",
"interval": "month",
"paymentType": "subscription"
}