Skip to main content

Overview

The ApiDisputeDocuments class provides methods for managing documents related to disputes. These documents are used as evidence when contesting chargebacks.

Methods

Get

Retrieve a dispute document by ID.
public function Get(string $documentId): DisputeDocument
documentId
string
required
The dispute document identifier
Returns: DisputeDocument object Example:
$doc = $api->DisputeDocuments->Get($documentId);
echo "Type: " . $doc->Type;
echo "Status: " . $doc->Status;

GetAll

Retrieve all dispute documents for the client.
public function GetAll(?Pagination &$pagination = null, ?Sorting $sorting = null, ?FilterKycDocuments $filter = null): array
pagination
Pagination
Pagination parameters (passed by reference)
sorting
Sorting
Sorting parameters
filter
FilterKycDocuments
Filter parameters
Returns: Array of DisputeDocument objects Example:
$pagination = new MangoPay\Pagination(1, 20);
$documents = $api->DisputeDocuments->GetAll($pagination);

foreach ($documents as $doc) {
    echo "Document {$doc->Id}: {$doc->Type}\n";
}

CreateDisputeDocumentConsult

Create temporary URLs to view dispute document pages.
public function CreateDisputeDocumentConsult(string $documentId, ?Pagination &$pagination = null): array
documentId
string
required
The dispute document identifier
pagination
Pagination
Pagination parameters
Returns: Array of DocumentPageConsult objects containing temporary view URLs Example:
$consults = $api->DisputeDocuments->CreateDisputeDocumentConsult($documentId);

foreach ($consults as $consult) {
    echo "View page at: " . $consult->Url . "\n";
    echo "Expires at: " . date('Y-m-d H:i:s', $consult->ExpirationDate) . "\n";
}

DisputeDocument Entity

The DisputeDocument object contains:
Id
string
Unique identifier
Type
string
Document type (DELIVERY_PROOF, INVOICE, REFUND_PROOF, USER_CORRESPONDANCE, etc.)
Status
string
Document status (CREATED, VALIDATION_ASKED, VALIDATED, REFUSED)
RefusedReasonType
string
Reason if document was refused
RefusedReasonMessage
string
Detailed message if refused
CreationDate
int
Unix timestamp of creation
ProcessedDate
int
Unix timestamp when processed
DisputeId
string
ID of the associated dispute

DocumentPageConsult Entity

Url
string
Temporary URL to view the document page
ExpirationDate
int
Unix timestamp when the URL expires (typically 10 minutes)

Document Types

Valid dispute document types:
  • DELIVERY_PROOF - Proof of delivery for physical goods
  • INVOICE - Invoice or receipt
  • REFUND_PROOF - Proof that refund was issued
  • USER_CORRESPONDANCE - Communication with the user
  • USER_ACCEPTANCE_PROOF - Proof user accepted terms
  • PRODUCT_REPLACEMENT_PROOF - Proof of product replacement
  • REFUND_REFUSAL_JUSTIFICATION_PROOF - Justification for refusing refund
  • TERMS_AND_CONDITIONS - Your terms and conditions
  • OTHER - Other supporting evidence

Complete Example

// Create a dispute document
$doc = new MangoPay\DisputeDocument();
$doc->Type = 'DELIVERY_PROOF';
$disputeDoc = $api->DisputeDocuments->CreateDisputeDocument($doc, $disputeId);

// Upload document pages (base64 encoded)
$pageContent = base64_encode(file_get_contents('/path/to/delivery-proof.pdf'));
$api->DisputeDocuments->CreateDisputeDocumentPage(
    $disputeId,
    $disputeDoc->Id,
    $pageContent
);

// Submit for validation
$disputeDoc->Status = 'VALIDATION_ASKED';
$submittedDoc = $api->DisputeDocuments->UpdateDisputeDocument($disputeId, $disputeDoc);

// Later: View the document pages
$consults = $api->DisputeDocuments->CreateDisputeDocumentConsult($disputeDoc->Id);
foreach ($consults as $consult) {
    // Display or process the temporary URL
    echo "View: " . $consult->Url . "\n";
}
Temporary view URLs expire after 10 minutes. Generate new consult URLs if you need to view the document again.

See Also

Build docs developers (and LLMs) love