Skip to content

Latest commit

 

History

History
411 lines (311 loc) · 12.7 KB

disputes.md

File metadata and controls

411 lines (311 loc) · 12.7 KB

Disputes

const disputesApi = client.disputesApi;

Class Name

DisputesApi

Methods

List Disputes

Returns a list of disputes associated with a particular account.

async listDisputes(
  cursor?: string,
  states?: string,
  locationId?: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<ListDisputesResponse>>

Parameters

Parameter Type Tags Description
cursor string | undefined Query, Optional A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see Pagination.
states string | undefined Query, Optional The dispute states used to filter the result. If not specified, the endpoint returns all disputes.
locationId string | undefined Query, Optional The ID of the location for which to return a list of disputes.
If not specified, the endpoint returns disputes associated with all locations.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

ListDisputesResponse

Example Usage

try {
  const { result, ...httpResponse } = await disputesApi.listDisputes();
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Retrieve Dispute

Returns details about a specific dispute.

async retrieveDispute(
  disputeId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveDisputeResponse>>

Parameters

Parameter Type Tags Description
disputeId string Template, Required The ID of the dispute you want more details about.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

RetrieveDisputeResponse

Example Usage

const disputeId = 'dispute_id2';
try {
  const { result, ...httpResponse } = await disputesApi.retrieveDispute(disputeId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Accept Dispute

Accepts the loss on a dispute. Square returns the disputed amount to the cardholder and updates the dispute state to ACCEPTED.

Square debits the disputed amount from the seller’s Square account. If the Square account does not have sufficient funds, Square debits the associated bank account.

async acceptDispute(
  disputeId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<AcceptDisputeResponse>>

Parameters

Parameter Type Tags Description
disputeId string Template, Required The ID of the dispute you want to accept.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

AcceptDisputeResponse

Example Usage

const disputeId = 'dispute_id2';
try {
  const { result, ...httpResponse } = await disputesApi.acceptDispute(disputeId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

List Dispute Evidence

Returns a list of evidence associated with a dispute.

async listDisputeEvidence(
  disputeId: string,
  cursor?: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<ListDisputeEvidenceResponse>>

Parameters

Parameter Type Tags Description
disputeId string Template, Required The ID of the dispute.
cursor string | undefined Query, Optional A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see Pagination.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

ListDisputeEvidenceResponse

Example Usage

const disputeId = 'dispute_id2';
try {
  const { result, ...httpResponse } = await disputesApi.listDisputeEvidence(disputeId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Create Dispute Evidence File

Uploads a file to use as evidence in a dispute challenge. The endpoint accepts HTTP multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats.

async createDisputeEvidenceFile(
  disputeId: string,
  request?: CreateDisputeEvidenceFileRequest,
  imageFile?: FileWrapper,
  requestOptions?: RequestOptions
): Promise<ApiResponse<CreateDisputeEvidenceFileResponse>>

Parameters

Parameter Type Tags Description
disputeId string Template, Required The ID of the dispute for which you want to upload evidence.
request CreateDisputeEvidenceFileRequest | undefined Form (JSON-Encoded), Optional Defines the parameters for a CreateDisputeEvidenceFile request.
imageFile FileWrapper | undefined Form, Optional -
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

CreateDisputeEvidenceFileResponse

Example Usage

const disputeId = 'dispute_id2';
try {
  const { result, ...httpResponse } = await disputesApi.createDisputeEvidenceFile(disputeId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Create Dispute Evidence Text

Uploads text to use as evidence for a dispute challenge.

async createDisputeEvidenceText(
  disputeId: string,
  body: CreateDisputeEvidenceTextRequest,
  requestOptions?: RequestOptions
): Promise<ApiResponse<CreateDisputeEvidenceTextResponse>>

Parameters

Parameter Type Tags Description
disputeId string Template, Required The ID of the dispute for which you want to upload evidence.
body CreateDisputeEvidenceTextRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

CreateDisputeEvidenceTextResponse

Example Usage

const disputeId = 'dispute_id2';
const contentType = null;
const bodyEvidenceType: string = {'' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null, '' : null } const body: CreateDisputeEvidenceTextRequest = {
  idempotencyKey: 'ed3ee3933d946f1514d505d173c82648',
  evidenceText: '1Z8888888888888888',
};
body.evidenceType = bodyEvidenceType;

try {
  const { result, ...httpResponse } = await disputesApi.createDisputeEvidenceText(disputeId, body);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Delete Dispute Evidence

Removes specified evidence from a dispute. Square does not send the bank any evidence that is removed.

async deleteDisputeEvidence(
  disputeId: string,
  evidenceId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<DeleteDisputeEvidenceResponse>>

Parameters

Parameter Type Tags Description
disputeId string Template, Required The ID of the dispute from which you want to remove evidence.
evidenceId string Template, Required The ID of the evidence you want to remove.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

DeleteDisputeEvidenceResponse

Example Usage

const disputeId = 'dispute_id2';
const evidenceId = 'evidence_id2';
try {
  const { result, ...httpResponse } = await disputesApi.deleteDisputeEvidence(disputeId, evidenceId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Retrieve Dispute Evidence

Returns the metadata for the evidence specified in the request URL path.

You must maintain a copy of any evidence uploaded if you want to reference it later. Evidence cannot be downloaded after you upload it.

async retrieveDisputeEvidence(
  disputeId: string,
  evidenceId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveDisputeEvidenceResponse>>

Parameters

Parameter Type Tags Description
disputeId string Template, Required The ID of the dispute from which you want to retrieve evidence metadata.
evidenceId string Template, Required The ID of the evidence to retrieve.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

RetrieveDisputeEvidenceResponse

Example Usage

const disputeId = 'dispute_id2';
const evidenceId = 'evidence_id2';
try {
  const { result, ...httpResponse } = await disputesApi.retrieveDisputeEvidence(disputeId, evidenceId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Submit Evidence

Submits evidence to the cardholder's bank.

The evidence submitted by this endpoint includes evidence uploaded using the CreateDisputeEvidenceFile and CreateDisputeEvidenceText endpoints and evidence automatically provided by Square, when available. Evidence cannot be removed from a dispute after submission.

async submitEvidence(
  disputeId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<SubmitEvidenceResponse>>

Parameters

Parameter Type Tags Description
disputeId string Template, Required The ID of the dispute for which you want to submit evidence.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

SubmitEvidenceResponse

Example Usage

const disputeId = 'dispute_id2';
try {
  const { result, ...httpResponse } = await disputesApi.submitEvidence(disputeId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}