34 lines
614 B
PHP
34 lines
614 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use Alipay\EasySDK\Kernel\EasySDKKernel;
|
|
use Alipay\EasySDK\Payment\App\Client as AppClient;
|
|
|
|
class AlipayService
|
|
{
|
|
public function __construct(
|
|
protected EasySDKKernel $kernel,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* 支付
|
|
*
|
|
* @param array $params
|
|
* @return array
|
|
*/
|
|
public function pay(array $params)
|
|
{
|
|
$result = (new AppClient($this->kernel))->pay(
|
|
$params['subject'],
|
|
$params['out_trade_no'],
|
|
$params['total_amount'],
|
|
);
|
|
|
|
return [
|
|
'body' => $result->body,
|
|
];
|
|
}
|
|
}
|