byrcsc/laravel-payrex · 1.x
Payouts.
Inspect the PayRex transactions that make up a payout and reconcile payments, refunds, adjustments, and deposits.
Payouts represent transfers of settled funds to the merchant's bank account. The package exposes the transaction-list endpoint implemented by the official PayRex SDK.
List payout transactions
use ByRcsc\LaravelPayrex\Facades\Payrex;
$transactions = Payrex::payouts()->listTransactions(
id: 'po_...',
limit: 100,
);
foreach ($transactions as $transaction) {
$transaction->id;
$transaction->amount;
$transaction->netAmount;
$transaction->transactionType;
$transaction->transactionId;
}The complete signature is:
listTransactions(
string $id,
?int $limit = null,
?string $before = null,
?string $after = null,
array $options = [],
): ListingPayoutTransactionType can be Payment, Refund, or Adjustment.
transactionId identifies the underlying record represented by the line.
Manual pagination
The payout transaction endpoint returns a Listing<PayoutTransaction>:
$page = Payrex::payouts()->listTransactions(
id: $payoutId,
limit: 100,
after: $lastTransactionId,
);
if ($page->hasMore) {
// Request the next page using the last transaction ID.
}There is no payout-specific autoPaging() or paginate() method in version
1.x.
Payout events
The package maps:
payout.createdtoPayoutCreated; andpayout.depositedtoPayoutDeposited.
The event's resource() method hydrates a Payout containing id, amount,
netAmount, status, destination, livemode, timestamps, and raw.
use ByRcsc\LaravelPayrex\Data\Payout;
use ByRcsc\LaravelPayrex\Events\PayoutDeposited;
public function handle(PayoutDeposited $event): void
{
$payout = $event->event->resource();
if (! $payout instanceof Payout) {
return;
}
// Reconcile the deposit by $payout->id.
}Other payout operations
The package intentionally does not guess payout routes that PayRex has not confirmed. If PayRex documents a new route before the package models it, use a low-level client call only after verifying the endpoint:
$payload = Payrex::get('/payouts/po_...');