Skip to main content

Disputes API

Manage payment disputes and chargebacks.

Methods

getDispute

Get a dispute by ID.

const dispute = await easy.getDispute("dis_123");

Parameters

  • disputeId (string, required): The ID of the dispute

Returns

Promise<ApiResponse<DisputeData>>;

getDisputes

List all disputes with optional filtering.

// Get all disputes with pagination
const disputes = await easy.getDisputes({
limit: 20,
offset: 0,
});

// Get specific disputes by ID
const specificDisputes = await easy.getDisputes({
ids: ["dis_123", "dis_456"],
});

Parameters

  • params (object, optional)
    • ids (string[], optional): Filter by specific dispute IDs
    • limit (number, optional): Maximum number of disputes to return
    • offset (number, optional): Number of disputes to skip

Returns

Promise<ApiResponse<DisputeData[]>>;

updateDispute

Update dispute tags/metadata.

const updated = await easy.updateDispute("dis_123", {
status: "resolved",
resolution_notes: "Customer refunded",
resolved_at: new Date().toISOString(),
});

Parameters

  • disputeId (string, required): The ID of the dispute
  • tags (object, required): Metadata to update

Returns

Promise<ApiResponse<DisputeData>>;

Example: Dispute Management

import { createClient } from "@easylabs/node";

const easy = await createClient({
apiKey: process.env.EASY_API_KEY!,
});

// Get all open disputes
const disputes = await easy.getDisputes({ limit: 50 });

for (const dispute of disputes.data) {
if (dispute.status === "OPEN") {
console.log(`Dispute ${dispute.id}:`);
console.log(` Transfer: ${dispute.transfer_id}`);
console.log(` Amount: $${dispute.amount / 100}`);
console.log(` Reason: ${dispute.reason}`);

// Update with tracking information
await easy.updateDispute(dispute.id, {
status: "under_review",
reviewed_by: "support_team",
notified_at: new Date().toISOString(),
});
}
}

Type Definitions

DisputeData

interface DisputeData {
id: string;
transfer_id: string;
amount: number;
currency: string;
status: "OPEN" | "UNDER_REVIEW" | "WON" | "LOST" | "RESOLVED";
reason: string;
created_at: string;
updated_at: string;
tags?: Record<string, unknown>;
}