PHP code example of juzaweb / payment-method

1. Go to this page and download the library: Download juzaweb/payment-method library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

juzaweb / payment-method example snippets



// PaymentMethodInterface interface
namespace Juzaweb\PaymentMethod\Support;

interface PaymentMethodInterface
{
    public function purchase(array $params): PaymentMethodInterface;

    public function completed(array $params): PaymentMethodInterface;

    public function isSuccessful(): bool;

    public function isRedirect(): bool;

    public function getRedirectURL(): null|string;

    public function getMessage(): string;

    public function getPaymentId(): string;

    public function setPaymentId(string $paymentId): static;

    public function getAmount(): float;

    public function setAmount(float $amount): static;
}

use Juzaweb\PaymentMethod\Contracts\PaymentMethodManager;
//...

public function handle(): void
{
    $this->addAction(Action::INIT_ACTION, [$this, 'paymentMethodInit']);
}

public function paymentMethodInit(): void
{
    app()->make(PaymentMethodManager::class)->register(
        'paypal',
        Paypal::class
    );
}