Laravel PayMongo

Disputes

A Dispute, or chargeback, is a card payment the cardholder's bank is reversing. It is not a refund: PayMongo holds the amount and a PHP 800 fee from your payout straight away, and you have 5 working days to answer with evidence. For the lifecycle and what to submit, read PayMongo's Disputes & Chargebacks guide.

The package reads disputes. Answering one, by submitting evidence or accepting it, happens in the PayMongo dashboard under Transactions > Disputes; PayMongo has no API for it.

Every method lives on Paymongo::disputes(), and a single dispute comes back as a Luigel\Paymongo\Data\Dispute. PayMongo's API reference does not document these endpoints yet. The typed attributes are amount, currency, status and reason, and the rest of the payload is available through attribute().

Retrieve a dispute

retrieve() returns one dispute. Take its id from the webhook:

use Luigel\Paymongo\Enums\DisputeStatus;
use Luigel\Paymongo\Facades\Paymongo;

$dispute = Paymongo::disputes()->retrieve('dsp_7HkQmPzW3xVbNcLtRfYs2DgA');

$dispute->money()?->format();                        // "₱1,500.50", held from your payout
$dispute->reason;                                    // ?string, e.g. "fraudulent"
$dispute->status === DisputeStatus::UnderReview;     // ?DisputeStatus: UnderReview, Won, Lost or Expired

List disputes

list() returns a page of disputes. Iterate it, check hasMore, call nextPage(), or lazy() to walk every page:

use Luigel\Paymongo\Facades\Paymongo;

foreach (Paymongo::disputes()->list(['limit' => 25])->lazy() as $dispute) {
    $dispute->id;     // "dsp_..."
    $dispute->status; // ?DisputeStatus
}

When PayMongo refuses

An account without dispute access gets a 403 with the code access_denied, thrown as a Luigel\Paymongo\Exceptions\InvalidRequestException. Test-mode accounts get it too, so Paymongo::fake() and Fixtures::dispute() are how to test your handling. See Testing.