# easy-invoice/2.4.3/templates/payments/view.php

Easy Invoice – Invoice Generator, PDF Quotes &amp; Payments, version 2.4.3. 262 lines.

- Page: https://pluginprobe.com/plugins/easy-invoice/2.4.3/code/templates/payments/view.php
- Raw: https://pluginprobe.com/plugins/easy-invoice/2.4.3/raw/templates/payments/view.php
- Modified: 2026-09-29T05:21:04+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/easy-invoice/2.4.3/code/templates/payments/view.php#L10-L20`.

```php
<?php
/**
 * Payment View Template
 *
 * @package Easy_Invoice
 */

namespace EasyInvoice\Templates\Payments;


if ( ! defined( 'ABSPATH' ) ) {
    exit;
}
use EasyInvoice\Models\Payment;
use EasyInvoice\Models\Invoice;

if (!isset($payment) || !($payment instanceof Payment)) {
    wp_die(esc_html__('Invalid payment', 'easy-invoice'));
}

$invoice_post = get_post($payment->getInvoiceId());
$invoice = $invoice_post ? new Invoice($invoice_post) : null;


?>

<div class="p-8">
    <div class="flex justify-between items-center mb-6">
        <h1 class="text-2xl font-bold text-gray-900">
            <?php /* translators: %s: payment id. */ printf(esc_html__('Payment #%s', 'easy-invoice'), (int) $payment->getId()); ?>
        </h1>
        <a href="<?php echo esc_url(admin_url('admin.php?page=easy-invoice-payments')); ?>" 
           class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
            <?php esc_html_e('Back to Payments', 'easy-invoice'); ?>
        </a>
    </div>

    <div class="bg-white shadow overflow-hidden sm:rounded-lg">
        <div class="px-4 py-5 sm:px-6 border-b border-gray-200">
            <h2 class="text-lg font-medium text-gray-900"><?php esc_html_e('Payment Information', 'easy-invoice'); ?></h2>
        </div>
        <div class="border-t border-gray-200">
            <dl>
                <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Payment ID', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">#<?php echo (int) $payment->getId(); ?></dd>
                </div>
                <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Invoice', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <?php if ($invoice): ?>
                        <a href="<?php echo esc_url(admin_url('admin.php?page=easy-invoice&action=edit&id=' . $invoice->getId())); ?>" 
                           class="text-indigo-600 hover:text-indigo-900">
                            <?php echo esc_html($invoice->getNumber()); ?>
                        </a>
                        <?php else: ?>
                        <span class="text-gray-400"><?php esc_html_e('Invoice not found', 'easy-invoice'); ?></span>
                        <?php endif; ?>
                    </dd>
                </div>
                <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Amount', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <?php echo esc_html($payment->getCurrencySymbol() . number_format((float) $payment->getAmount(), 2)); ?>
                    </dd>
                </div>
                <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Payment Method', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <?php 
                        $payment_method = $payment->getPaymentMethod();
                        if (empty($payment_method)) {
                            // Try direct property access
                            $payment_method = $payment->payment_method;
                        }
                        if (empty($payment_method)) {
                            // Try direct meta access
                            $payment_method = get_post_meta($payment->getId(), '_payment_method', true);
                        }
                        

                        
                        echo esc_html(ucfirst($payment_method ?: __('Not specified', 'easy-invoice'))); 
                        ?>
                    </dd>
                </div>
                <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Status', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm sm:mt-0 sm:col-span-2">
                        <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full 
                            <?php
                            switch ($payment->getStatus()) {
                                case 'completed':
                                    echo 'bg-green-100 text-green-800';
                                    break;
                                case 'pending':
                                case 'pending-bank':
                                case 'pending-cheque':
                                case 'pending_verification':
                                    echo 'bg-yellow-100 text-yellow-800';
                                    break;
                                case 'failed':
                                    echo 'bg-red-100 text-red-800';
                                    break;
                                default:
                                    echo 'bg-gray-100 text-gray-800';
                            }
                            ?>">
                            <?php
                            $ei_vs = (string) $payment->getStatus();
                            if (in_array($ei_vs, \EasyInvoice\Services\OfflinePayments::pendingStatuses(), true)) {
                                esc_html_e('Awaiting confirmation', 'easy-invoice');
                            } elseif ('rejected' === $ei_vs) {
                                esc_html_e('Rejected', 'easy-invoice');
                            } else {
                                echo esc_html(ucfirst($ei_vs));
                            }
                            ?>
                        </span>
                    </dd>
                </div>
                <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Date', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <?php echo esc_html(date_i18n(get_option('date_format'), strtotime($payment->getPaymentDate()))); ?>
                    </dd>
                </div>
                <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Type', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <?php echo esc_html(ucfirst($payment->getPaymentType())); ?>
                    </dd>
                </div>
                <?php if ($payment->getRecurringId()) : ?>
                <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Recurring ID', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <?php echo esc_html($payment->getRecurringId()); ?>
                    </dd>
                </div>
                <?php endif; ?>
                <?php if ($payment->getParentPaymentId()) : ?>
                <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Parent Payment', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <a href="<?php echo esc_url(admin_url('admin.php?page=easy-invoice-payments&action=view&id=' . $payment->getParentPaymentId())); ?>" 
                           class="text-indigo-600 hover:text-indigo-900">
                            #<?php echo (int) $payment->getParentPaymentId(); ?>
                        </a>
                    </dd>
                </div>
                <?php endif; ?>
                <?php if ($payment->getNotes()) : ?>
                <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Notes', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <?php echo nl2br(esc_html($payment->getNotes())); ?>
                    </dd>
                </div>
                <?php endif; ?>
                <?php
                // What the client told us when they submitted an offline payment, and what staff did with it.
                $ei_pid       = (int) $payment->getId();
                $ei_reference = (string) get_post_meta($ei_pid, \EasyInvoice\Services\OfflinePayments::META_REFERENCE, true);
                $ei_has_proof = \EasyInvoice\Services\OfflinePayments::hasProof($ei_pid);
                $ei_proof_nm  = (string) get_post_meta($ei_pid, \EasyInvoice\Services\OfflinePayments::META_PROOF_NAME, true);
                $ei_status    = (string) $payment->getStatus();
                $ei_pending   = in_array($ei_status, \EasyInvoice\Services\OfflinePayments::pendingStatuses(), true);
                $ei_verified  = (int) get_post_meta($ei_pid, '_verified_by', true);
                $ei_rejected  = (int) get_post_meta($ei_pid, '_rejected_by', true);
                ?>
                <?php if ('' !== $ei_reference) : ?>
                <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Reference given by the client', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2"><?php echo esc_html($ei_reference); ?></dd>
                </div>
                <?php endif; ?>
                <?php if ($ei_has_proof) : ?>
                <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Receipt', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <a class="inline-flex items-center gap-1 font-medium text-indigo-600 hover:text-indigo-900" target="_blank" rel="noopener" href="<?php echo esc_url(\EasyInvoice\Services\OfflinePayments::proofUrl($ei_pid)); ?>">
                            <?php echo esc_html('' !== $ei_proof_nm ? $ei_proof_nm : __('Open receipt', 'easy-invoice')); ?>
                        </a>
                        <span class="block text-xs text-gray-400"><?php esc_html_e('Only signed-in staff can open this file.', 'easy-invoice'); ?></span>
                    </dd>
                </div>
                <?php elseif ($ei_pending) : ?>
                <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Receipt', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-500 sm:mt-0 sm:col-span-2"><?php esc_html_e('None attached.', 'easy-invoice'); ?></dd>
                </div>
                <?php endif; ?>
                <?php if ($ei_verified || $ei_rejected) : $ei_who = get_userdata($ei_verified ?: $ei_rejected); $ei_when = (string) get_post_meta($ei_pid, $ei_verified ? '_verified_at' : '_rejected_at', true); ?>
                <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php echo $ei_verified ? esc_html__('Confirmed by', 'easy-invoice') : esc_html__('Rejected by', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <?php echo esc_html($ei_who ? $ei_who->display_name : __('Unknown user', 'easy-invoice')); ?>
                        <?php if ('' !== $ei_when && strtotime($ei_when)) : ?>
                            <span class="text-gray-500">· <?php echo esc_html(date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($ei_when))); ?></span>
                        <?php endif; ?>
                    </dd>
                </div>
                <?php endif; ?>
                <?php if ($ei_pending && easy_invoice_user_can('ei_record_payment')) : ?>
                <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Decision', 'easy-invoice'); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <a href="<?php echo esc_url(admin_url('admin.php?page=easy-invoice-payments&status=pending')); ?>" class="font-medium text-indigo-600 hover:text-indigo-900"><?php esc_html_e('Confirm or reject it from the Payments list', 'easy-invoice'); ?></a>
                    </dd>
                </div>
                <?php endif; ?>
            </dl>
        </div>

        <?php 
        $gateway_response_raw = $payment->getGatewayResponse();
        $gateway_response = null;
        
        if ($gateway_response_raw) {
            // Try to decode JSON if it's a string
            if (is_string($gateway_response_raw)) {
                $gateway_response = json_decode($gateway_response_raw, true);
            } elseif (is_array($gateway_response_raw)) {
                $gateway_response = $gateway_response_raw;
            }
        }
        
        if ($gateway_response && is_array($gateway_response)) : 
        ?>
        <div class="px-4 py-5 sm:px-6 border-t border-gray-200">
            <h2 class="text-lg font-medium text-gray-900"><?php esc_html_e('Gateway Response', 'easy-invoice'); ?></h2>
        </div>
        <div class="border-t border-gray-200">
            <dl>
                <?php 
                $loop = 0;
                foreach ($gateway_response as $key => $value) : 
                    $loop++;
                ?>
                <div class="<?php echo $loop % 2 === 0 ? 'bg-white' : 'bg-gray-50'; ?> px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
                    <dt class="text-sm font-medium text-gray-500"><?php echo esc_html(ucwords(str_replace('_', ' ', $key))); ?></dt>
                    <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
                        <?php 
                        if (is_array($value)) {
                            echo '<pre class="text-xs bg-gray-100 p-2 rounded overflow-x-auto">' . esc_html(json_encode($value, JSON_PRETTY_PRINT)) . '</pre>';
                        } elseif (is_bool($value)) {
                            echo $value ? 'Yes' : 'No';
                        } elseif (is_null($value)) {
                            echo '<em>null</em>';
                        } else {
                            echo esc_html($value);
                        }
                        ?>
                    </dd>
                </div>
                <?php endforeach; ?>
            </dl>
        </div>
        <?php endif; ?>
    </div>
</div> 
```
