Reconcile the subscription with Onvo after the SDK confirmed payment
const url = 'https://api.emite.cr/v1/billing/subscription/sync';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"subscriptionId":"example"}'};
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/subscription/sync \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "subscriptionId": "example" }'Call it when the Onvo SDK reports success on a checkout answer with paymentType='subscription' — a new subscription from POST /billing/plan-change, a recovery (POST /billing/recovery) or an accepted quote (POST /billing/quotes/:id/accept) — passing the subscriptionId the SDK confirmed (without it, the pending subscription is reconciled, else the live one). The subscription is read back from Onvo and the request is never trusted for the grant: the plan and cadence come from the metadata stamped on it at creation, and the plan becomes effective only once Onvo reports it active with its charge collected — then the subscription it replaces is canceled so it is not billed twice, and an accepted quote becomes accepted. Answers the status read back; anything other than active means the plan has not changed yet. Idempotent, and Onvo's subscription.renewal.succeeded webhook (sent for the first charge too) and the reconcile reach the same result if this call is lost. 400 NO_ACTIVE_SUBSCRIPTION when there is nothing to reconcile or the id is not a subscription of this company's; 400 SUBSCRIPTION_SUPERSEDED when the paid subscription is older than the one in force (it is canceled and a case is opened for the EmiteCR team to refund it); 400 SUBSCRIPTION_PLAN_UNRESOLVED when the money is in but the plan cannot be applied (the team finishes it); 400 PLAN_MANAGED_BY_FUTURA_BYTE on a granted plan.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The Onvo subscription id the SDK just confirmed (validated against the tenant's recorded pending/live ids). Omitting it falls back to pending-first.
Examplegenerated
{ "subscriptionId": "example"}Responses
Section titled “Responses”object
Reconciled subscription status after the SDK confirmed payment.
Examplegenerated
{ "status": "example"}