For the complete documentation index, see llms.txt. This page is also available as Markdown.

Recovery Cases API

List and read retained-commission recovery cases and their allocations: endpoints, parameters, permissions, fields and errors.

Read the recovery cases for your app, with every amount recovered and where it came from. The API is read-only. For how cases work, see Retained Commission Recovery.

Method
Path
Returns

GET

/v1/recovery_cases

A page of cases, newest first, without allocations.

GET

/v1/recovery_cases/{id}

One case, with its allocations.

See the API reference: List Recovery Cases and Get Recovery Case.

Authentication and Access

Send your usual channel headers: X-Violet-Token, X-Violet-App-Secret and X-Violet-App-Id.

  • You see only your own app's cases. The token's developer account must own the app in X-Violet-App-Id.

  • Retailer tokens are refused.

  • A case that belongs to another app returns 404, exactly as a case that does not exist.

List Cases

GET /v1/recovery_cases
Query parameter
Type
Default
Notes

app_id

integer

your app

If sent, it must be the app in X-Violet-App-Id.

merchant_id

integer

all retailers

The retailer must be connected to your app.

status

string

all

OPENED, RECOVERING, RECOVERED or EXHAUSTED. Not case-sensitive.

page

integer

1

1-based. A page past the end returns an empty content list.

size

integer

20

1 to 100. Values outside the range are clamped.

Cases are sorted newest first.

The response is a page object. content holds the cases, total_elements the number of matching cases, and size the page size. number is the page index counted from zero, so ?page=1 returns "number": 0.

Get a Case

Case Fields

Every field is always present, and is null when it has no value. Amounts are integers in minor units (cents) of currency.

Field
Type
Description

id

integer

The recovery case ID. Also the join key between Violet's records and yours.

recovery_case_id

integer

Same as id, matching the webhook payload.

refund_id

integer

The Violet refund that opened the case.

order_id, bag_id

integer

The refunded order and bag.

merchant_id

integer

The retailer that owes the amount.

payout_account_id

integer

The retailer's payout account for the refunded sale.

currency

string

The case currency: the currency of the Stripe account the order was paid through. A case that is EXHAUSTED with CURRENCY_UNKNOWN is in the refunded bag's currency instead. See Currency.

gap_amount

integer

The commission you kept on this refund.

shortfall_amount

integer

Any shortfall on the sale's own reversal. Usually 0.

shortfall_unknown

boolean

true when the shortfall could not be measured.

amount_to_recover

integer

What the sale's own reversal returned, plus gap_amount, plus shortfall_amount.

amount_recovered

integer

The sale's own reversal plus every executed draw. Equals the sum of the allocations whose status is EXECUTED.

remaining_gap

integer

amount_to_recover − amount_recovered. Zero or less means nothing is owed.

gap_amount_usd, shortfall_amount_usd, amount_to_recover_usd

integer

The same amounts in US cents, at rates fixed when the case opened. null when a rate was not available.

status

string

OPENED, RECOVERING, RECOVERED or EXHAUSTED.

escalation

string

RUNGS_1_2_EXHAUSTED when the case is EXHAUSTED, otherwise null.

exhausted_reason

string

NO_DONOR_HEADROOM, TRANSFER_METHOD_NOT_AUTOMATIC, CURRENCY_UNKNOWN or SHORTFALL_UNKNOWN when exhausted, otherwise null. See Exhausted cases.

transfer_reversal_ids

array of integers

Violet Transfer Reversal IDs: the sale's own reversal first, then each executed draw.

date_created, date_last_modified

string

ISO 8601 timestamps in UTC.

allocations

array

Single-case response only. Left out of list results.

Allocation Fields

An allocation is one amount recovered for the case, from one sale. seq 0 is the refund's own reversal of the sale's transfer; it is not a draw Violet made for the case, so its id is null. Draws start at seq 1. When a draw reverses a transfer that paid for several sales, it is listed as one allocation per sale, all with the same seq and the same Stripe reversal.

Field
Type
Description

id

integer

The allocation ID. null for seq 0.

recovery_case_id

integer

The case.

seq

integer

Order within the case.

funding_type

string

OWN_TRANSACTION (the sale's own transfer) or BORROWED_REVERSAL (another of the retailer's transfers).

window

string

OWN, IN_WINDOW (a sale in the 120 days before the case opened) or BEYOND_WINDOW.

status

string

EXECUTED or FAILED. A draw still in progress is not listed and does not count in amount_recovered.

amount

integer

Amount recovered by this allocation.

currency

string

Currency of amount.

stripe_transfer_reversal_id

string

The Stripe transfer reversal (trr_…).

stripe_transfer_id

string

The Stripe transfer drawn on (tr_…).

funding_payout_transfer_id

integer

The Violet Transfer drawn on.

donor_order_id, donor_bag_id

integer

The order and bag the amount came from. For seq 0 and other draws on the sale's own transfer, this is the refunded order and bag.

failure_reason

string

Set only when status is FAILED.

date_created, date_last_modified

string

ISO 8601 timestamps in UTC. For seq 0, the case's own dates.

Errors

Status
Error
When

400

invalid_parameter

status is not one of the four values.

400

missing_parameter

A required parameter is missing.

403

insufficient_permissions

A retailer token or no token; app_id is not your app; the token's developer does not own the app; or merchant_id is not connected to your app.

404

recovery_case_not_found

The case does not exist or belongs to another app.

Notes

  • The API can list a case shortly before its RECOVERY_CASE_OPENED webhook arrives, for example while Violet waits for the shopper's refund to be confirmed.

  • The amounts on a case are read fresh from its allocations each time, so a case read straight after a webhook may already show a later draw.

Last updated

Was this helpful?