文件名称:php的支付宝手机网关支付组件alipay_wap.zip
文件大小:32KB
文件格式:ZIP
更新时间:2022-08-07 23:43:04
开源项目
目的支付宝的demo很搓项目需要接入很多支付,磋上加搓,不是特别好管理本类库的目标完成跟支付宝手机网关支付对接的功能便于后面扩展(利用各种Handler),可测试如何使用本类库?1. 预先加载配置目前提供文件的方式加载配置use HuNanZai\Component\Pay\Package\Alipay_wap\Api as AlipayApi; use HuNanZai\Component\Pay\Package\Alipay_wap\Handler\PhpFileConfigHandler as ConfigHandler; $config_handler = new ConfigHandler(__DIR__.'/config.php'); $alipay_api = new AlipayApi($config_handler->getConfig());config.php<?php return array( 'partner' => 'xxxxxxxxxxxxxxxx', 'seller_id' => 'xxxxxxxxxxxxxxxx', 'private_key_path' => __DIR__.'/resource/rsa_private_key.pem', 'public_key_path' => __DIR__.'/resource/rsa_public_key.pem', 'cacert' => __DIR__.'resource/cacert.pem', );调用对应的api即可支付use HuNanZai\Component\Pay\Package\Alipay_wap\Handler\ArrayPayParamHandler as PayParamHandler; $pay_param_handler = new PayParamHandler(array( 'out_trade_no' => date('YmdHis), 'subject' => '', 'total_fee' => '0.01', //可空 'notify_url' => '', 'return_url' => '', )); $alipay_api->pay($pay_param_handler->getParam());支付同步返回验证...略过上面的类似步骤 $callback_param_handler = new CallbackParamHander($_GET); $res = $alipay_api->verifyCallback($callback_param_handler->getParam());支付异步通知验证$notify_param_handler = new NotifyParamHandler($_POST); $res = $alipay_api->verifyNotify($notify_param_handler->getParam());查询订单$param_handler = new SearchRequestParamHandler(array( 'trade_no' => '', 'out_trade_no' => '', )); $result = $alipay_api->search($param_handler->getParam());退款$refund_param_handler = new RefundParamHandler(array( 'refund_date' => date('Y-m-d H:i:s'), 'batch_no' => date('YmdHis'), 'batch_num' => 1, 'detail_data' => 'xxxx^0.01^测试退款', )); $result = $alipay_api->refund($refund_param_handler->getParam()); 标签:alipay
【文件预览】:
alipay_wap-master
----composer.json(559B)
----README.MD(2KB)
----tests()
--------ParamTest()
----src()
--------Config.php(3KB)
--------Submit.php(3KB)
--------Factory()
--------Handler()
--------Support()
--------Param()
--------Notify.php(4KB)
--------Encryption()
--------Api.php(2KB)
--------Exception()
----.gitignore(112B)
----demo()
--------bootstrap.php(230B)
--------notify.php(804B)
--------refund.php(780B)
--------callback.php(893B)
--------pay.php(847B)
--------search.php(1KB)
--------refund_notify.php(94B)