- 授权协议: 未知
- 开发语言: PHP
- 操作系统: 跨平台
- 软件首页: https://github.com/HuNanZai/alipay_wap
- 官方下载: https://github.com/HuNanZai/alipay_wap/archive/master.zip
软件介绍
目的
支付宝的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());
C程序设计语言
(美)Brian W. Kernighan、(美)Dennis M. Ritchie / 徐宝文、李志译、尤晋元审校 / 机械工业出版社 / 2004-1 / 30.00元
在计算机发展的历史上,没有哪一种程序设计语言像C语言这样应用广泛。本书原著即为C语言的设计者之一Dennis M.Ritchie和著名计算机科学家Brian W.Kernighan合著的一本介绍C语言的权威经典著作。我们现在见到的大量论述C语言程序设计的教材和专著均以此书为蓝本。原著第1版中介绍的C语言成为后来广泛使用的C语言版本——标准C的基础。人们熟知的“hello,World"程序就是由本书......一起来看看 《C程序设计语言》 这本书的介绍吧!
