juzaweb/payment-method

此包最新版本(1.0.2)没有提供许可证信息。

适用于Juzaweb CMS的支付方式插件

安装: 30

依赖: 1

建议者: 0

安全: 0

星星: 1

关注者: 1

分支: 0

公开问题: 0

类型:juzaweb-plugin

1.0.2 2024-04-30 03:24 UTC

This package is auto-updated.

Last update: 2024-08-30 11:38:44 UTC


README

  • Paypal支付支持
  • Stripe支付支持

开发

添加支付方式

  • 创建实现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;
}

查看示例 PayPal支付

  • 在PaymentMethodManager中注册支付方式

在您的HookAction处理程序中

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