helei112g / payment Goto Github PK
View Code? Open in Web Editor NEWPayment是php版本的支付聚合第三方sdk,集成了微信支付、支付宝支付、招商一网通支付。提供统一的调用接口,方便快速接入各种支付、查询、退款、转账能力。服务端接入支付功能,方便、快捷。
License: MIT License
Payment是php版本的支付聚合第三方sdk,集成了微信支付、支付宝支付、招商一网通支付。提供统一的调用接口,方便快速接入各种支付、查询、退款、转账能力。服务端接入支付功能,方便、快捷。
License: MIT License
就是打开支付宝PC网页支付吗,在学习支付,没有相应帐号,不知道怎么玩。
即时到帐接口就是打开PC网页的那个支付是吗?
本次实现接口:
在用 ali_wap 支付的时候,生成的同样的链接,有人访问成功,有人不成功。不同清楚为什么。请问有遇到吗?图片传不上来。。
支付宝移动支付接口,签名算法不需要排序,只要求保持请求参数的顺序和待签名参数的顺序一致。可是我看代码在计算签名的时候进行了排序,返回参数的时候却没有排序,我想问一下,这样是不是会有问题?
新申请的支付宝即时到账接口现在只支持新的接口了,现在这个类用不了
WxConfig类中构造函数中设置了cacertPath 导致要把证书放到你的源码中的/CacertFile下
调式打印出的rul访问数据正确
你好,我想问下在rsa 配置都正确下,为什么还提醒 错误代码 ILLEGAL_SIGN?
另外回调那里需要new一个类,改成匿名函数是不是好点。。 不然我在框架里使用,那个类无法使用框架里的其他方法。
rt。
目前是每次调用的时候,传入配置。
但如果我连续调用,貌似得每次都传入配置文件。
比如,我做退款操作,可能后台不间断退款几十笔交易,每一次都传入配置是不合理的
不过退款我还没开始做,如果说错了请包涵, 谢谢。
以下是微信转换后的结果:
Array
(
[bank_type] => CMB_CREDIT
[cash_fee] => 0.01
[device_info] => WEB
[fee_type] => CNY
[is_subscribe] => Y
[buyer_id] => ofTN_wajIjD_cbPl8G14YSTOSNxE
[order_no] => 2017031311425179
[pay_time] => 2017-03-13 11:42:58
[amount] => 1
[trade_type] => JSAPI
[transaction_id] => 4008512001201703133210173000
[trade_state] => success
[channel] => wx_charge
)
amount单位是元,所以值应该是0.01
是关于microtime()方法的用法。在7.1中会报错
php 7.1 报错 a non well formed numeric value encountered
请问扫码支付完成之后回调通知怎么验证,好像没有找到使用方法?
测试号无法登陆如何测试扫码呢?
https://qr.alipay.com/bax09620fro8v8nuf0pl0049
微信支付中 md5_key 配置项, 是APPSECRET 还是 KEY 呢?
希望可以集成微信刷卡支付 新接口
Payment\Utils\ArrayUtil::paraFilter()
...if ($val === '') {continue;} ...
请问这里为什么是全等?我用的时候,全等生成的结果会有问题。改成‘==’就可以正常了。
请问这里改成全等的用意是什么?
请问该SDK支持PC 端支付吗? :)
来一份二开的说明,大家好来增加服务商,比如百付宝、京东支付、翼支付 等等....
微信支付订单返回值
支付订单中关于 response 中包含字段的描述
trade_state 交易状态 支付成功与否,可取值:success not_pay
遇到的第一个坑,记一下
您好:
根据您的示例,我集成到我们的项目中,正式环境配置,支付宝能够下单成功。并且也能够唤起手机APP进行支付,支付成功后。后台始终是FAIL,似乎无法验证签名。
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in
vendor\riverslei\payment\src\Charge\Wx\WxQrCharge.php on line 20
return QrChargeData::class;
Demo修改了配置始终有下面的错误
Fatal error: Uncaught Exception: 您使用的私钥格式错误,请检查RSA私钥配置 in D:\xampp\htdocs\abc.com\vendor\riverslei\payment\src\Utils\Rsa2Encrypt.php:46 Stack trace:
ali_app,需要用到return_param这个参数自定义一些参数。使用简单的字符串(aaa)可以使用,但是如果要使用多个键值的(a=1&b=2)时,应该怎么处理使用呢?
在AliConfig.php中看到这样:
// 新版只支持此种签名方式 商户生成签名字符串所使用的签名算法类型,目前支持RSA
$this->signType = 'RSA';
但是在管理应用的时候支付宝推荐的是RSA2的签名方式参考:
https://doc.open.alipay.com/docs/doc.htm?treeId=291&articleId=106115&docType=1
https://doc.open.alipay.com/doc2/detail.htm?treeId=200&articleId=105310&docType=1
支付宝APP支付接口,对传递参数支持无序,也就是传递过去什么顺序的参数,直接进行签名和验签,
而我们的程序是统一排序后进行签名,但是实际传递的参数并不是排序后的结果。因此支付宝APP支付应该是实际传递参数进行排序,并且将sign_type 拼接到最后。
AppChargeData.php 改为:$this->retData = ArrayUtil::arraySort(ArrayUtil::paraFilter($signData)); //进行一下排序
AliAppCharge.php 里面的retData() 改为:
$data['sign'] = '"'. urlencode($data['sign']) . '"';
$signType = $data['sign_type'];
unset($data['sign_type']); //去掉sign_type
$data['sign_type'] = $signType; //放到最后
return ArrayUtil::createLinkstring($data);
bcdiv 函数 需要在 PHP 编译的时候使用 --enable-bcmath 开启方可使用,但 readme 中并未说明需要 BC 函数库,建议加入。
又或者是使用其他的方式来代替 bcdiv 函数,毕竟一般的生产环境上很少使用到 BC 函数库的,而 PHP 的编译,还是尽量以精简为目的的好。
微信公众号如果是服务商需要传递sub_mch_id,微信返回提示,目前不知道哪里设置
环境: PHP 7.0.8
The magic method __get() must have public visibility and cannot be static line 58 in file /vendor/riverslei/payment/src/Common/BaseData.php
你好
今天在部署payment 2 到 nginx 服务器上的时候,出现404报错,
我用的是代码里面 /examples/charge.php 测试的,在本地上运行正常,可以正常返回。
把文件上传到服务器上后却会有问题(没有改动任何代码)。
不知您是否有空帮忙看下是什么问题?
谢谢!
以下是错误提示:
Fatal error: Uncaught Error: Call to undefined function Payment\Common\Ali\Data\Charge\bccomp() in /var/www/<project_folder>/vendor/riverslei/payment/src/Common/Ali/Data/Charge/ChargeBaseData.php:89 Stack trace:
#0 /var/www/<project_folder>/vendor/riverslei/payment/src/Common/BaseData.php(43): Payment\Common\Ali\Data\Charge\ChargeBaseData->checkDataParam()
#1 /var/www/<project_folder>/vendor/riverslei/payment/src/Common/Ali/AliBaseStrategy.php(66): Payment\Common\BaseData->__construct(Object(Payment\Common\AliConfig), Array)
#2 /var/www/<project_folder>/vendor/riverslei/payment/src/ChargeContext.php(121): Payment\Common\Ali\AliBaseStrategy->handle(Array)
#3 /var/www/<project_folder>/vendor/riverslei/payment/src/Client/Charge.php(55): Payment\ in /var/www/<project_folder>/vendor/riverslei/payment/src/Common/Ali/Data/Charge/ChargeBaseData.php on line 89
设置 $channel = 'ali_qr';发生 网络发生错误,请稍后再试
2.0如何升级3.0 3.0版本有什么大的改动呢?
代码在 Common/Weixin/Data/Charge 40行
key是app_id而不是appid 不然API会报错
appid 或者 mch_id 不存在
但是改成了app_id了 后提示 微信返回错误提示:
是空的
因为项目为商业项目 需要兼容大部分环境 最低环境为5.4 使用payment中有几个语法的支持不支持5.4 请问可以做兼容么 目前是自己修改了不兼容的部分
不过文档有点少啊,没找到调用的例子
作为参考,作者可以看下easywechat 文档
网络发生错误,请稍后再试curl返回码:1
为啥出现这种情况?
使用的是PHP-7.0.3
Problem 1
- Installation request for riverslei/payment ^2.7.0 -> satisfiable by riverslei/payment[v2.7.0].
- riverslei/payment v2.7.0 requires mbstring * -> no matching package found.
我的扩展已经装了,2.7.0中的composer.json中的依赖是不是要改成
ext-mbstring : *
fork之后重打了标签,改成上述的样子就可以正常安装了。
参考:
https://getcomposer.org/doc/02-libraries.md#platform-packages
PHP Notice – yii\base\ErrorException
Undefined index: use_sandbox
当然这还是可以使用,但是开发环境我报错级别都是 notice会报错的,建议修一下。
如果配置中设置
$config['sign_type'] = 'RSA2';
则会出现 使用 ali_web (即时到账)无法通过签名,该问题的原因是:即时到账不支持rsa2签名,需要使用rsa签名。
在现在sdk基础上,解决方案:
在调用时,判断是否是使用 ali_web
支付方式,如果是,运行时设置 sing_type
$config = [
];
if ($payWay === 'ali_web') {
$config['sign_type'] = 'RSA';
}
try {
$url = Charge::run($payWay, $config, $payData);
} catch (PayException $e) {
echo $e->errorMessage();
exit;
}
通过此种方式可以解决。
该问题,将在3.1.1 版本中修复,到时候,无需调用者判断,sdk内部会判断如果是 即时到账,就自动设置sign_type的签名方式。
感谢 微信昵称:@里幕色中 发现该问题
原因是:接口使用的是2.0的接口,但底层的phpSDK使用的还是老的sdk,支付宝那边识别不了,还是按照老的接口返回,结果就给了it_b_pay这个字段,但是客户端新版的sdk是不支持这个it_b_pay字段的,结果就打不开网页支付页面了
开发一下新版本的接口吧
如题,看介绍,得用企业账号去申请 微信公共服务号,才能开通微信服务。
目前很多开发者并无企业去申请相关账号,
所以微信可以申请类似支付宝的沙箱应用吗
根据你的文章Payment:支付的回调统一处理来处理Notify通知,但是为什么Notify中的$data
的amount
和pay_amount
都是null的?好多都是null,如下
INFO: array (
'amount' => NULL,
'buyer_id' => '2088xxxxxxxx',
'transaction_id' => '2017xxxxxxxxxxxx69',
'body' => '测试',
'notify_time' => '2017-05-02 15:08:50',
'subject' => '测试',
'buyer_account' => NULL,
'auth_app_id' => NULL,
'notify_type' => 'trade_status_sync',
'invoice_amount' => NULL,
'order_no' => '2017xxxxxxx4120',
'trade_state' => 'success',
'pay_time' => '2017-05-02 15:08:49',
'point_amount' => NULL,
'trade_create_time' => '2017-05-02 15:08:47',
'pay_amount' => NULL,
'receipt_amount' => NULL,
'fund_bill_list' => NULL,
'app_id' => NULL,
'seller_id' => '2088xxxxxxxx',
'seller_email' => '[email protected]',
'channel' => 'ali_charge',
)
调用 手机支付宝客服端 都报
操作已超时,请重新发起支付
PHP接入支付宝有密退款接口 ,新版本还是有密接口吗?
微信扫码支付现在是使用模式二
有没有模式一的SDK谢谢~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.