Skip to main content
Submitting a settlement closes an invoice by recording proof of USDC payment on Arc. You provide the invoice ID, a unique reference hash, and the payer and merchant wallet addresses. Retempo submits the transaction, waits for an on-chain receipt and a SettlementRecorded event, then returns the settlement as CONFIRMED. The associated invoice is automatically marked PAID at the same time.

Request Body

string
required
The ID of the invoice this settlement closes.
string
required
A unique 32-byte identifier for this settlement, encoded as a hex string — 0x followed by exactly 64 hex characters (e.g. 0xabcdef12...). You generate this value and use it to deduplicate submissions. Submissions with a malformed hash are rejected with 400.
string
required
The EVM wallet address of the payer. Must be a valid, non-zero checksummed address.
string
required
The EVM wallet address of the merchant. Must be a valid, non-zero checksummed address.
string
The Retempo user ID of the payer. If provided, it must match the userId on the invoice. If omitted, defaults to the invoice’s userId.
string
The Retempo user ID of the merchant. If provided, it must match the ownerId of the associated service. If omitted, defaults to the service owner.
string | number
The settlement amount as a decimal string or number. If omitted, Retempo uses the invoice amount. Must be a non-negative decimal.
string
The currency of the settlement. Defaults to the invoice currency if omitted.
string
An ISO 8601 datetime string for when the settlement occurred. Defaults to the time of the API call if omitted.

Response

A successful settlement returns HTTP 201 Created with both a settlement object and a chain object containing the on-chain transaction details.
object
The confirmed settlement record with related objects.
object
On-chain transaction details returned alongside the settlement.

201 — Settlement confirmed

Example Request

Error Codes

Idempotency

Settlements are idempotent on the combination of invoiceId and referenceHash. If you submit a settlement with the same pair and a matching settlement already exists in CONFIRMED status, Retempo returns 200 with the existing settlement record instead of creating a duplicate. Use this behavior to safely retry on network failures without risk of double-charging.
The referenceHash must be exactly 32 bytes as a hex string — 0x followed by exactly 64 hex characters. Submissions with a malformed hash are rejected immediately with a 400 error and the message "referenceHash must be a 32-byte hex value.".
A settlement is marked CONFIRMED only after a real on-chain transaction receipt and SettlementRecorded event are observed. The endpoint does not return until that verification is complete. If verification fails, the settlement is recorded as FAILED and a 500 is returned.