6
0
Fork 0
jiqu-library-server/app/Services/AlipayService.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,
];
}
}