juzaweb / payment-method
此包最新版本(1.0.2)没有提供许可证信息。
适用于Juzaweb CMS的支付方式插件
1.0.2
2024-04-30 03:24 UTC
Requires
- league/omnipay: ^3
- omnipay/paypal: ^3.0
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 ); }