Miare
Integration guides

Accounting and invoices

Estimates

Use Estimate Price to estimate one course from latitude,longitude source and destination coordinates. The result is an estimate in Tomans. It excludes trip-level cost and boost; environmental conditions can affect the final amount. Fetch Boost Levels periodically and include the selected amount when estimating a boosted order.

Proxy invoicing

Proxy invoicing must be enabled for your API account. Register the seller before creating a trip and pass its client-scoped identifier as pickup.seller_id. Missing or unregistered seller IDs reject trip creation. Both seller creation and update return HTTP 201. Omitted optional fields retain their values on update; null clears them when validation permits.

Use the current trip batch_id with Get Trip Invoice. Omit revision for the latest invoice or request revision 0 for the original. Later adjustments increase the revision; revisions_count is the highest available revision number. HTTP 202 means generation is in progress: wait for retry_after seconds or the Retry-After response header before polling. A ready response includes an expiring private download URL valid for five minutes. Invoice PDFs and financial event delivery have separate availability.

Financial events

Financial events report batch accounting results separately from trip lifecycle events. They have top-level batch identifiers and financial fields, without a trip wrapper.

Financial notifications must be enabled for your account by the technical team and require a configured webhook URL. Invoice PDF availability is separate; receiving a financial event does not mean that a PDF is ready or available for that batch.

Events

EventStateDescription
financial_calculatedcalculatedInitial financial calculation has completed. Revision is 0 and changes is empty. Eligible trips deleted by Miare receive zero total and zero detail amounts.
financial_adjustedchangedA course has subsequently been marked invalid (course_faked) and recalculation changed the batch total. Revision is greater than 0; changes contains the cumulative adjustment history. A recalculation with no change to the total emits no adjustment event.

All monetary values in financial events are in Tomans (IRT).

ValueTypeDescription
eventstringfinancial_calculated or financial_adjusted.
batch_idstring [UUID]Stable accounting batch identifier across revisions. It can differ from the original trip IDs after batching.
revisionnumber [integer]0 for the initial calculation; increasing positive values for adjustments to the same batch.
trip_idsarray of string [UUID]Unique client-visible trip IDs; original trip IDs are retained after batching.
course_idsarray of string [UUID]Course identifiers. Adjustment payloads include invalidated courses for traceability.
bill_numbersarray of stringUnique non-empty bill numbers. Not positionally aligned with trip_ids or course_ids.
statestringFinancial state: calculated or changed. This is separate from the trip lifecycle state.
financials.total_costnumber [integer]Complete batch total at this revision, including all adjustments so far. Use this as the authoritative total.
financials.details.base_costnumber [integer]Base-cost component of the calculation.
financials.details.cancel_costnumber [integer]Late-cancellation component.
financials.details.delay_costnumber [integer]Pickup-delay component.
financials.details.return_costnumber [integer]Return component.
changesarray of objectEmpty at revision 0; cumulative adjustment history on later revisions.

The detail fields cover these four pricing components and may not sum to total_cost, which can include other pricing rules, discounts, and rounding. Arrays of identifiers are correlation fields, not a mapping of individual courses to trips or bills.

Reconciliation

Deduplicate by (batch_id, revision) and retain the highest revision seen. Revision 0 can arrive after a later adjustment. Replace the saved total with financials.total_cost; do not add changes again because it is cumulative history. Identifier arrays are correlation fields and are not positionally aligned. A recalculation that leaves the total unchanged emits no adjustment event. Eligible trips deleted by Miare have zero totals and zero detail amounts.

Recover the latest snapshot with Get Financial Detail: GET /api/accounting/financial-detail/{batch_id}/. It requires your API token and returns the financial event fields without event. HTTP 404 means the batch is unknown or financial data is not yet available. Use this endpoint for financial reconciliation and List Trips for lifecycle recovery.

Financial notifications require enablement and a configured webhook URL. They omit X-Miare-API-Version; revision tracks batch financial changes. Any non-2XX response or network failure triggers retry with a ten-second timeout. Default configurable delays are 30, 120, 300, 900 and 1800 seconds, and every retry preserves the original payload. The webhook reference includes both financial schemas and examples.

Last modified on