# booktics/1.0.0/core/payment/payment-method-manager.php

Booktics – Appointment Booking Calendar for Service Businesses, version 1.0.0. 43 lines.

- Page: https://pluginprobe.com/plugins/booktics/1.0.0/code/core/payment/payment-method-manager.php
- Raw: https://pluginprobe.com/plugins/booktics/1.0.0/raw/core/payment/payment-method-manager.php
- Modified: 2025-07-03T16:48: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/booktics/1.0.0/code/core/payment/payment-method-manager.php#L10-L20`.

```php
<?php

namespace Booktics\Payment;

use Booktics\Payment\Contracts\Payment_Method_Interface;
use WP_Error;

/**
 * Manager for payment methods.
 *
 * Allows registering and retrieving payment methods. Also handles processing
 * payments using a specified payment method.
 *
 * @package Booktics\Core\Payment
 * @since 1.0.0
 */
class Payment_Method_Manager {

    private $payment_methods = array();

    public function __construct() {
        $this->payment_methods = apply_filters( 'booktics_payment_methods', array() );
    }

    /**
     * Get all registered payment methods
     *
     * @return array
     */
    public function get_payment_methods(): array {
        return apply_filters( 'booktics_payment_methods', $this->payment_methods );
    }

    public function get_payment_method( string $id ): ?Payment_Method_Interface {
        $payment_methods = $this->get_payment_methods();
        if ( ! isset( $payment_methods[ $id ] ) ) {
            return null;
        }

        return new $payment_methods[ $id ]();
    }
}

```
