SET API · SET Close
One match per payment: its records, rule and state
GET/v1/close/matches
Lists matches: one per payment, naming the record in each slot (rail, provider, chain, book), the rule that paired them and the state. An uploaded line that belongs to no payment SET can name is its own match. Newest first, paged by createdBefore.
Query parameters
periodstringYYYY-MM: only matches in this month.state"pending" | "matched" | "exception" | "ignored"- Only matches in this state. Anything else is 400
state_invalid. rule"linked" | "hash" | "reference" | "amount_date"- Only matches paired by this rule.
reasonstring- An exception reason (
missing_rail,missing_provider,missing_chain,missing_book,amount_mismatch,ambiguous,chain_unconfirmed,duplicate,prior_period) or an ignored reason (before_start,not_moved). Anything else is 400reason_invalid. customerstring- A customer id (
cus_…): only that customer's matches. inTransit"true" | "false"- Only matches that are (or are not) in transit. Anything else is 400
in_transit_invalid. createdBeforestring- The last answer's
nextCreatedBefore, passed back unchanged, or an ISO 8601 time: matches created strictly before it. limitinteger- 1 to 100; 50 by default.
Notes
- SET Close is switched on per deployment; when it is off, every
/v1/closecall answers 403close_offafter the key is checked.GET /v1/capabilitiesshows it asfeatures.close. - Needs a key with the
readscope. Platform and business keys can both call it. - An uploaded line that belongs to no payment SET can name has
paymentTypeexternalandpaymentnull. state:pending(not final yet),matched,exception,ignored.rule:linked(SET's own ledger tied the records),hash,reference,amount_date(equal amount and direction within 3 calendar days, and the only candidate).- A returned payment is matched, not ignored;
returnedis not a reason. varianceis{amount, currency}when two sides disagree on an amount.- In the example, the 98.50 bank line of the 4th matched the payment settled on the 3rd by
amount_date. The 247.50 line of the 15th is more than 3 days from its payment of the 8th, so the payment ismissing_railand the line is its ownmissing_providerexception. The 12.00 bank fee belongs to no payment. - Payments made through SET also become matches, usually
matchedby rulelinked, after SET's scheduled pass, which runs every 10 minutes. - The example was made with a sandbox key (
sandbox: true). - This example is a recorded run of SET's own code (wallet release
e9b03447) with a sandbox key; ids and times are that run's.
Errors
403 close_off400 created_before_invalid400 period_invalid400 customer_invalid400 state_invalid400 reason_invalid400 in_transit_invalid