disputes_api = client.disputes
DisputesApi
- List Disputes
- Retrieve Dispute
- Accept Dispute
- List Dispute Evidence
- Remove Dispute Evidence
- Retrieve Dispute Evidence
- Create Dispute Evidence File
- Create Dispute Evidence Text
- Submit Evidence
Returns a list of disputes associated with a particular account.
def list_disputes(cursor: nil,
states: nil,
location_id: nil)
Parameter | Type | Tags | Description |
---|---|---|---|
cursor |
String |
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 (Dispute State) |
Query, Optional | The dispute states to filter the result. If not specified, the endpoint returns all open disputes (the dispute status is not INQUIRY_CLOSED , WON ,or LOST ). |
location_id |
String |
Query, Optional | The ID of the location for which to return a list of disputes. If not specified, the endpoint returns all open disputes (the dispute status is not INQUIRY_CLOSED , WON , or LOST ) associated with all locations. |
cursor = 'cursor6'
states = 'EVIDENCE_REQUIRED'
location_id = 'location_id4'
result = disputes_api.list_disputes(cursor: cursor, states: states, location_id: location_id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Returns details about a specific dispute.
def retrieve_dispute(dispute_id:)
Parameter | Type | Tags | Description |
---|---|---|---|
dispute_id |
String |
Template, Required | The ID of the dispute you want more details about. |
Retrieve Dispute Response Hash
dispute_id = 'dispute_id2'
result = disputes_api.retrieve_dispute(dispute_id: dispute_id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
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.
def accept_dispute(dispute_id:)
Parameter | Type | Tags | Description |
---|---|---|---|
dispute_id |
String |
Template, Required | The ID of the dispute you want to accept. |
dispute_id = 'dispute_id2'
result = disputes_api.accept_dispute(dispute_id: dispute_id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Returns a list of evidence associated with a dispute.
def list_dispute_evidence(dispute_id:)
Parameter | Type | Tags | Description |
---|---|---|---|
dispute_id |
String |
Template, Required | The ID of the dispute. |
List Dispute Evidence Response Hash
dispute_id = 'dispute_id2'
result = disputes_api.list_dispute_evidence(dispute_id: dispute_id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Removes specified evidence from a dispute.
Square does not send the bank any evidence that is removed. Also, you cannot remove evidence after submitting it to the bank using SubmitEvidence.
def remove_dispute_evidence(dispute_id:,
evidence_id:)
Parameter | Type | Tags | Description |
---|---|---|---|
dispute_id |
String |
Template, Required | The ID of the dispute you want to remove evidence from. |
evidence_id |
String |
Template, Required | The ID of the evidence you want to remove. |
Remove Dispute Evidence Response Hash
dispute_id = 'dispute_id2'
evidence_id = 'evidence_id2'
result = disputes_api.remove_dispute_evidence(dispute_id: dispute_id, evidence_id: evidence_id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Returns the specific evidence metadata associated with a specific dispute.
You must maintain a copy of the evidence you upload if you want to reference it later. You cannot download the evidence after you upload it.
def retrieve_dispute_evidence(dispute_id:,
evidence_id:)
Parameter | Type | Tags | Description |
---|---|---|---|
dispute_id |
String |
Template, Required | The ID of the dispute that you want to retrieve evidence from. |
evidence_id |
String |
Template, Required | The ID of the evidence to retrieve. |
Retrieve Dispute Evidence Response Hash
dispute_id = 'dispute_id2'
evidence_id = 'evidence_id2'
result = disputes_api.retrieve_dispute_evidence(dispute_id: dispute_id, evidence_id: evidence_id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
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.
def create_dispute_evidence_file(dispute_id:,
request: nil,
image_file: nil)
Parameter | Type | Tags | Description |
---|---|---|---|
dispute_id |
String |
Template, Required | The ID of the dispute you want to upload evidence for. |
request |
Create Dispute Evidence File Request Hash |
Form, Optional | Defines the parameters for a CreateDisputeEvidenceFile request. |
image_file |
File | UploadIO |
Form, Optional | - |
Create Dispute Evidence File Response Hash
dispute_id = 'dispute_id2'
request = {}
request[:idempotency_key] = 'idempotency_key2'
request[:evidence_type] = 'REBUTTAL_EXPLANATION'
request[:content_type] = 'content_type0'
image_file = FileWrapper.new(File::open('dummy_file', 'rb'), content_type: 'optional-content-type')
result = disputes_api.create_dispute_evidence_file(dispute_id: dispute_id, request: request, image_file: image_file)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Uploads text to use as evidence for a dispute challenge.
def create_dispute_evidence_text(dispute_id:,
body:)
Parameter | Type | Tags | Description |
---|---|---|---|
dispute_id |
String |
Template, Required | The ID of the dispute you want to upload evidence for. |
body |
Create Dispute Evidence Text Request Hash |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Create Dispute Evidence Text Response Hash
dispute_id = 'dispute_id2'
body = {}
body[:idempotency_key] = 'ed3ee3933d946f1514d505d173c82648'
body[:evidence_type] = 'TRACKING_NUMBER'
body[:evidence_text] = '1Z8888888888888888'
result = disputes_api.create_dispute_evidence_text(dispute_id: dispute_id, body: body)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Submits evidence to the cardholder's bank.
Before submitting evidence, Square compiles all available evidence. This includes evidence uploaded using the CreateDisputeEvidenceFile and CreateDisputeEvidenceText endpoints and evidence automatically provided by Square, when available.
def submit_evidence(dispute_id:)
Parameter | Type | Tags | Description |
---|---|---|---|
dispute_id |
String |
Template, Required | The ID of the dispute that you want to submit evidence for. |
dispute_id = 'dispute_id2'
result = disputes_api.submit_evidence(dispute_id: dispute_id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end