juzaweb/payment-method

There is no license information available for the latest version (1.0.2) of this package.

Payment method plugin for Juzaweb CMS

Installs: 32

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:juzaweb-plugin

1.0.2 2024-04-30 03:24 UTC

This package is auto-updated.

Last update: 2024-10-30 12:00:37 UTC


README

  • Paypal Payment support
  • Stripe Payment support

Development

Add a payment method

  • Create class implement PaymentMethodInterface
<?php
// 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;
}

View example PayPal payment

  • Register payment method in PaymentMethodManager

In your HookAction handle

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
    );
}