How to handle disputes in OFFER-HUB — opening, resolving, and managing disagreements between buyers and sellers.
Note
This is the public API/SDK guide for integrators. For internal implementation detail (Orchestrator state machine, signer roles), see docs/guides/disputes.md in the repo.
Disputes are a critical part of any marketplace. When a buyer and seller disagree, OFFER-HUB provides a structured process to resolve conflicts fairly while funds remain safely locked in escrow.
Tip
Disputes only apply to orders that have funded escrow. For orders still in FUNDS_RESERVED, use the cancel flow instead.
When to Use Disputes
A dispute should be opened when:
Work not delivered — Seller missed the deadline or abandoned the order
Quality issues — Deliverables don't match the agreed specifications
Partial delivery — Only some of the work was completed
Communication breakdown — Seller is unresponsive
Warning
Disputes should be a last resort. Encourage buyers and sellers to communicate and resolve issues directly when possible.
Dispute Lifecycle
State Machine
Two lifecycles move together during a dispute. The dispute record itself goes OPEN to UNDER_REVIEW to RESOLVED, as shown in the Dispute state machine. The diagram below is the order's side of it: opening the dispute moves the order from IN_PROGRESS to DISPUTED, and resolving it settles the funds. The full order machine is in the Orders Guide.
Split resolution requires both releaseAmount (seller) and refundAmount (buyer) to sum to the original escrow amount.
Resolution Request Body
Documentation table
Field
Type
Required
Description
decision
string
Yes
"FULL_RELEASE", "FULL_REFUND", or "SPLIT"
note
string
No
Internal note for the decision
releaseAmount
string
Split only
Amount to release to seller
refundAmount
string
Split only
Amount to refund to buyer
Resolution Response
json
{ "data": { "id": "dsp_abc123", "status": "resolved", "decision": "FULL_REFUND", "resolvedBy": "usr_support", "resolvedAt": "2026-02-25T14:00:00.000Z", "note": "Seller failed to deliver work within agreed timeframe", "order": { "id": "ord_xyz789", "status": "REFUNDED" } }}
Adding Comments to Disputes
Both parties and support can add comments during the dispute:
bash
curl -X POST http://localhost:4000/api/v1/disputes/dsp_abc123/comments \ -H "Authorization: Bearer ohk_live_your_api_key" \ -H "Content-Type: application/json" \ -d '{ "userId": "usr_buyer123", "message": "Here is the original agreement showing the deadline was February 20th", "attachments": ["https://example.com/contract.pdf"] }'
Comment Response
json
{ "data": { "id": "cmt_def456", "disputeId": "dsp_abc123", "userId": "usr_buyer123", "message": "Here is the original agreement...", "attachments": ["https://example.com/contract.pdf"], "createdAt": "2026-02-25T11:00:00.000Z" }}
Listing Disputes
GET /disputes accepts three optional filters: orderId, status (OPEN, UNDER_REVIEW, RESOLVED) and openedBy (BUYER, SELLER). It is not paginated: it returns every match, newest first (DisputesController.listDisputes, ResolutionService.listDisputes).
bash
# All open disputescurl "http://localhost:4000/api/v1/disputes?status=OPEN" \ -H "Authorization: Bearer ohk_live_your_api_key"# The dispute on one ordercurl "http://localhost:4000/api/v1/disputes?orderId=ord_xyz789" \ -H "Authorization: Bearer ohk_live_your_api_key"# Disputes opened by buyerscurl "http://localhost:4000/api/v1/disputes?openedBy=BUYER" \ -H "Authorization: Bearer ohk_live_your_api_key"
Response
The controller returns { success, data }, which the response interceptor wraps once more. See Response Format.
{ "data": { "id": "dsp_abc123", "orderId": "ord_xyz789", "openedBy": "usr_buyer123", "reason": "Seller has not delivered the agreed work after 2 weeks", "status": "open", "openedAt": "2026-02-25T10:00:00.000Z", "order": { "id": "ord_xyz789", "amount": "50.00", "currency": "USD", "buyerId": "usr_buyer123", "sellerId": "usr_seller456", "title": "Logo Design" }, "comments": [ { "id": "cmt_def456", "userId": "usr_buyer123", "message": "Here is the original agreement...", "createdAt": "2026-02-25T11:00:00.000Z" } ] }}
Using the SDK
typescript
import { OfferHubSDK } from '@offerhub/sdk';const sdk = new OfferHubSDK({ apiUrl: 'http://localhost:4000', apiKey: 'ohk_live_your_api_key'});// Open a disputeconst dispute = await sdk.disputes.open('ord_xyz789', { reason: 'Work not delivered as specified'});// Add a commentawait sdk.disputes.addComment(dispute.id, { userId: 'usr_buyer123', message: 'Additional evidence attached', attachments: ['https://example.com/screenshot.png']});// Resolve the dispute (requires support scope)await sdk.disputes.resolve(dispute.id, { decision: 'FULL_REFUND', note: 'Seller confirmed they could not complete the work'});
Listening to Dispute Events
typescript
const events = sdk.events.subscribe();events.on('order.disputed', (data) => { console.log('New dispute:', data.disputeId); // Notify support team notifySupport(data);});events.on('dispute.resolved', (data) => { console.log('Dispute resolved:', data.decision); // Notify both parties notifyParties(data);});
Real-Time Dispute Events (SSE)
Dispute lifecycle events are delivered over the SSE event stream at GET /api/v1/events — there is no outbound webhook API: