# give/4.17.0/src/Framework/PaymentGateways/Webhooks/EventHandlers/DonationProcessing.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.17.0. 44 lines.

- Page: https://pluginprobe.com/plugins/give/4.17.0/code/src/Framework/PaymentGateways/Webhooks/EventHandlers/DonationProcessing.php
- Raw: https://pluginprobe.com/plugins/give/4.17.0/raw/src/Framework/PaymentGateways/Webhooks/EventHandlers/DonationProcessing.php
- Modified: 2026-06-24T16:23:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.17.0/code/src/Framework/PaymentGateways/Webhooks/EventHandlers/DonationProcessing.php#L10-L20`.

```php
<?php

namespace Give\Framework\PaymentGateways\Webhooks\EventHandlers;

use Exception;
use Give\Donations\Models\Donation;
use Give\Donations\ValueObjects\DonationStatus;
use Give\Framework\PaymentGateways\Webhooks\EventHandlers\Actions\UpdateDonationStatus;

/**
 * @since 3.6.0
 */
class DonationProcessing
{
    /**
     * @since 4.16.0 Add $donationId to support gateways that only receive the transaction ID via webhook (e.g. PayFast).
     * @since 3.6.0
     * @throws Exception
     */
    public function __invoke(string $gatewayTransactionId, string $message = '', bool $skipRecurringDonations = false, int $donationId = 0)
    {
        if ($donationId > 0) {
            $donation = Donation::find($donationId);

            if ($donation) {
                $donation->gatewayTransactionId = $gatewayTransactionId;
                $donation->save();
            }
        } else {
            $donation = give()->donations->getByGatewayTransactionId($gatewayTransactionId);
        }

        if ( ! $donation || $donation->status->isProcessing()) {
            return;
        }

        if ($skipRecurringDonations && ! $donation->type->isSingle()) {
            return;
        }

        (new UpdateDonationStatus())($donation, DonationStatus::PROCESSING(), $message);
    }
}

```
