Overview
The ApiRepudiations class provides methods for managing repudiations. A repudiation is created when a dispute is lost, resulting in funds being withdrawn from your account into a dedicated repudiation wallet.
Methods
Get
Retrieve a repudiation by ID.
public function Get(string $repudiationId): Repudiation
The repudiation identifier
Returns: Repudiation object
Example:
$repudiation = $api->Repudiations->Get($repudiationId);
echo "Repudiation amount: " . $repudiation->DebitedFunds->Amount . "\n";
echo "Reason: " . $repudiation->DisputeReasonType . "\n";
GetRefunds
Retrieve refunds pertaining to a repudiation.
public function GetRefunds(string $repudiationId, ?Pagination &$pagination = null, ?FilterRefunds $filter = null, ?Sorting $sorting = null): array
Pagination parameters (passed by reference)
Returns: Array of Refund objects
Example:
$pagination = new MangoPay\Pagination(1, 10);
$refunds = $api->Repudiations->GetRefunds($repudiationId, $pagination);
foreach ($refunds as $refund) {
echo "Refund {$refund->Id}: " . $refund->Status . "\n";
}
Repudiation Entity
The Repudiation object inherits from Transaction and contains:
User ID whose wallet was debited
Amount withdrawn due to lost dispute
Amount credited to repudiation wallet
Fees charged for the repudiation
Transaction status (SUCCEEDED, FAILED)
Human-readable result message
ID of the dispute that led to this repudiation
ID of the original transaction
Reason for the dispute (FRAUD, DUPLICATE, etc.)
ID of the repudiation wallet
Unix timestamp of creation
Unix timestamp of execution
Understanding Repudiations
Repudiations occur when:
- A user initiates a chargeback with their bank
- You contest the dispute with evidence
- The bank rules in favor of the cardholder
- Funds are automatically withdrawn from your wallet
- A repudiation transaction is created
The repudiation amount includes:
- The disputed transaction amount
- Any applicable fees
Handling Repudiations
// Get a repudiation
$repudiation = $api->Repudiations->Get($repudiationId);
if ($repudiation->Status === 'SUCCEEDED') {
// Repudiation was processed
$lostAmount = $repudiation->DebitedFunds->Amount;
// Check related dispute
$dispute = $api->Disputes->Get($repudiation->DisputeId);
echo "Lost dispute type: " . $dispute->DisputeType . "\n";
// Create settlement transfer to cover the repudiation
$transfer = new MangoPay\SettlementTransfer();
$transfer->AuthorId = $yourUserId;
$transfer->DebitedFunds = new MangoPay\Money();
$transfer->DebitedFunds->Amount = $lostAmount;
$transfer->DebitedFunds->Currency = $repudiation->DebitedFunds->Currency;
$transfer->Fees = new MangoPay\Money();
$transfer->Fees->Amount = 0;
$transfer->Fees->Currency = $repudiation->DebitedFunds->Currency;
$settlementTransfer = $api->Disputes->CreateSettlementTransfer(
$transfer,
$repudiation->Id
);
echo "Settlement transfer created: " . $settlementTransfer->Id . "\n";
}
Settlement Process
After a repudiation:
- Repudiation Wallet: Funds are moved to a dedicated repudiation wallet
- Settlement Transfer: You must create a settlement transfer from one of your wallets to cover the repudiation
- Balance Restoration: Once settled, the repudiation is closed
Repudiations must be settled promptly. Mangopay may automatically debit your fees wallet or client wallet if a repudiation remains unsettled.
Example: Complete Repudiation Handling
// Monitor repudiations via webhook or polling
$filter = new MangoPay\FilterDisputes();
$filter->Status = 'CLOSED'; // Lost disputes
$disputes = $api->Disputes->GetAll(null, null, $filter);
foreach ($disputes as $dispute) {
if ($dispute->ResultCode === 'LOST') {
// Get the repudiation
$repudiation = $api->Disputes->GetRepudiation($dispute->RepudiationId);
// Create settlement transfer
$transfer = new MangoPay\SettlementTransfer();
$transfer->AuthorId = $platformOwnerId;
$transfer->DebitedFunds = clone $repudiation->DebitedFunds;
$transfer->Fees = new MangoPay\Money();
$transfer->Fees->Amount = 0;
$transfer->Fees->Currency = $repudiation->DebitedFunds->Currency;
$api->Disputes->CreateSettlementTransfer(
$transfer,
$repudiation->Id
);
// Log the loss
error_log("Settled repudiation {$repudiation->Id} for €" .
($repudiation->DebitedFunds->Amount / 100));
}
}
See Also