Report a repayment

POST /api/v1/mystery/billing/repayments packs:read

Reports an on-chain USDC repayment of your receivable. Send the owed amount as USDC to repayment.address (from GET /billing), then POST the transaction hash. The transfer is verified ON-CHAIN — the credited amount is the sum decoded from the USDC Transfer logs to the repayment address, never your claim — so this endpoint can’t move money and shares the packs:read scope with the billing reads. Owed usage rows are then marked repaid strictly oldest-first (invoice_ref repay:<tx_hash>) while the credit covers them; any excess stays as unapplied credit consumed automatically by future accruals. Idempotent by tx_hash: a tx is only ever credited once, to one partner — replaying returns the original row with already_recorded: true.

Try it POST /api/v1/mystery/billing/repayments write

These inputs are shared across all docs pages — an id entered here carries over.

request body
object · 1 keys
{
  "tx_hash": ""
}
response

Not run yet — press Run to make a live call against https://service.rip.fun (through this demo's server-side proxy; the API key never reaches the browser).

curl (tracks the inputs above)
curl -X POST 'https://service.rip.fun/api/v1/mystery/billing/repayments' \
  -H 'X-API-Key: rip_…' \
  -H 'Content-Type: application/json' \
  -d '{"tx_hash":""}'

Request fields

FieldTypeRequiredDescription
tx_hashstringyes0x-prefixed 32-byte hash of the mined USDC transfer (`txHash` accepted as an alias)

Response fields (data)

FieldDescription
repaymentThe recorded row: tx_hash, verified amount_usdc, applied_usdc, from/to/token address, block_number
already_recordedtrue when this tx was reported before (idempotent replay — nothing new settled)
settled_items / settled_usdcUsage rows stamped repaid by this call and their total
remaining_credit_usdcVerified credit left over after settlement (drained by the next accrual/repayment)

Errors

StatusCodeWhen
400invalid_tx_hashtx_hash is not a 0x-prefixed 32-byte transaction hash
400tx_not_confirmedthe tx is not mined yet, or contains no USDC transfer to the repayment address — wait for confirmation and retry
400tx_revertedthe transaction reverted on-chain — nothing was transferred
409tx_already_creditedthis tx was already credited to a different partner
409tx_wrong_partnerthe USDC left a wallet registered to a different partner
503repayment_address_unconfiguredno repayment address configured yet — contact rip.fun

See Errors for the response envelope and the full code list.

Flow

  1. GET /billing → owed_usdc + repayment.address
  2. Send owed_usdc as USDC (Base) to repayment.address from your wallet
  3. POST /billing/repayments {"tx_hash":"0x…"} once the tx is mined
  4. rip.fun verifies the transfer on-chain and stamps owed usage repaid oldest-first (invoice_ref repay:<tx_hash>)
  5. Overpayment stays as credit — GET /billing shows it as repayment.unapplied_credit_usdc