# Unify-Payment 方鼎统一支付平台v2,PHP接入版 ## 使用 php环境需 >= 7.4 ### Composer 安装 1. composer.json 的 repositories 项添加本地文件夹路径 ```json { "repositories": [ { "type": "path", "url": "./unify_payment" } ] } ``` 2. 执行require命令 ```bash $ composer require fd_wechat/unify_payment ``` ## 基本用法 ### 支付模块 #### miniClient / officialClient ```php mini->jsapi($order); // 公众号支付 Factory::pay($config)->official->jsapi($order); ``` ### 通用模块 #### orderClient ```php order->query($order); // 订单关闭 $order = new CloseOrder('FD2022080310000055123451223'); Factory::common($config)->order->close($order); // 订单退款 $order = new RefundOrder('FD2022080310000055123451223', 'FD2022080310000055123451223_12345', 0.01, 'Test Refund'); Factory::common($config)->order->refund($order); // 外部订单确认 $order = new ConfirmOrderForEx('FD2022080310000055123451223', 'ZSD0002974832', 'ow8NuxN_ALO2MzSvzj19hyxWjCVY', '4200067674202302063709953797'); Factory::common($config)->order->confirmForEx($order); ``` ### 添加第三方Client ```php $app = Factory::pay($config); $app->registerOtherClient('other', OtherClient::class); $app->other->doSomeThing(...); ``` ### 数据Mock Mock数据类在目录 `./src/Mock` 下 ```php $mockHandler = new CreateWeChatOrderHandler(true); Factory::pay($config)->official->setMockHandler([$mockHandler])->jsapi($order); ```