# give/4.16.9/src/Repositories/PaymentsRepository.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.16.9. 31 lines.

- Page: https://pluginprobe.com/plugins/give/4.16.9/code/src/Repositories/PaymentsRepository.php
- Raw: https://pluginprobe.com/plugins/give/4.16.9/raw/src/Repositories/PaymentsRepository.php
- Modified: 2021-11-23T23:55:18+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.16.9/code/src/Repositories/PaymentsRepository.php#L10-L20`.

```php
<?php

namespace Give\Repositories;

use Give_Payment;

class PaymentsRepository
{
    /**
     * Retrieves a donation for the given payment ID
     *
     * @since 2.8.0
     *
     * @param string $paymentId
     *
     * @return Give_Payment
     */
    public function getDonationByPayment($paymentId)
    {
        $payments = give_get_payments(
            [
                'meta_key' => '_give_payment_transaction_id',
                'meta_value' => $paymentId,
                'number' => 1,
            ]
        );

        return empty($payments) ? null : $payments[0];
    }
}

```
