lokielse / omnipay-unionpay Goto Github PK
View Code? Open in Web Editor NEWUnionPay driver for the Omnipay PHP payment processing library
License: MIT License
UnionPay driver for the Omnipay PHP payment processing library
License: MIT License
退款接口提示一下错误 重复交易[2010002]
根据官方提示 操作无效
如果有要求一定要用同一个订单号的话,建议按一定格式修改原订单号,比如在原订单号前面加个“T”、后面加个“1”来表示是第一次退货。
/** * [unionpayRefund 银联退款] * @param [type] $order [description] * @param [type] $gateway [description] * @return [type] [description] */ protected function unionpayRefund($order, $gateway) { $biz = [ 'orderId' => $order['order_id'], 'txnTime' => date('YmdHis', strtotime($order['created_at']['date'])), 'txnAmt' => $order['fee'] * 100, 'queryId' => $order['query_id'], ]; return $gateway->refund($biz)->send(); }
查询是可以,说明证书配置、签名都无误(用的5.1的证书)
但是发起消费请求银联端就提示 交易失败 11[9100004]Signature verification failed
@lokielse 嗨,你好。
银联支付消费接口,返回的结果当中,如果发生错误时,
$this->data['respCode'] !== '00'
其中还有比较有意义的返回错误信息,我希望能将此信息报出异常,方便排查错误,因此说比直接判断有没有tn
字段,来得友好(或不友好)。
我建议添加以下改进:
public function isSuccessful()
{
if ('00' !== $this->data['respCode']) {
throw new \Exception(sprintf('Err: code %s, message %s', $this->data['respCode'], $this->data['respMsg']));
}
return isset($this->data['tn']);
}
demo中无跳转支付现在是基于token版本开发,没有看到基础版相关代码。
官方最新参数(以下以消费为例,对应当前vendor/lokielse/omnipay-unionpay/src/Message/WtzConsumeRequest.php;其余无跳转支付文件也有不同参数):
token版:txnType=01,txnSubType=01,bizType=000902,tokenPayData=...
基础版数:txnType=01,txnSubType=01,bizType=000301,accNo=...,customerInfo=...
交易失败 11[9100004]Signature verification failed
无论我用沙盒环境的商户号和证书,还是正式的,都报这个错误
PHP 7.4
"lokielse/omnipay-unionpay": "^3.0"
https://gateway.test.95516.com/gateway/api/frontTransReq.do
交易失败 11[9100004]Signature verification failed
我配置了生产环境的证书,现在请求的地址还是
https://gateway.test.95516.com/gateway/api/frontTransReq.do
不知道是否应该请求为
https://gateway.95516.com/gateway/api/frontTransReq.do
如果是的话 这个配置哪里修改或者文档哪里查看(我暂没有找到)
秘钥是按照邮件给的生产的 其他证书(是上传秘钥的界面下载的)
测试环境没有问题、生产环境 验签失败、这是我第一次做此类项目 如果问题问的不好、也希望能回答一下、非常感谢
如题。
if (is_file($cert)) {
$certs = file_get_contents($cert);
}
//需要加上这两行才行
openssl_pkcs12_read($certData, $certs, $pass)
$cert = $certs['cert'];
$certData = openssl_x509_parse($cert);
return $certData['serialNumber'];
作者好!我这边最近急需使用无跳转支付,在readme里看是显示的 alpha 状态, 想知道现在这个支付方式的可用性怎样?谢谢!
使用最新版本的omnipay-unionpay.银联网关开发版本试了都不行.麻烦有空回复下,谢谢!
如下图所示,开发包里是通过respCode等于00判断是否支付
但是在实际支付过程中,如果用户输入了错误的,用户在未正确支付的情况下,收到的通知结果如下:
{ "accNo": "6216***********0018", "merId": "777290058176106", "certId": "69026276696", "txnAmt": "1", "bizType": "000201", "orderId": "101720042913364919949986965519", "queryId": "302004291336490032748", "respMsg": "成功[0000000]", "traceNo": "003274", "txnTime": "20200429133649", "txnType": "01", "version": "5.0.0", "encoding": "utf-8", "respCode": "00", "settleAmt": "1", "signature": "gwKTt2Udcl32uaYZVbxfTQJXQXvxv1wFgucYIFbcNH15Zfa45hTdDaXnPjGZ8iR28tYkYL12XMZxX4/0SaVhsKHXTS+/RUAqa5MeqHm78ZQhRbwY/QITsjEKHpEHxo1/Yit114L3IVV5rECwIfeI2ZknMx+t3bJku6589MNRMxn2i8FGBCVCVKR9MFNBwNrvBWvw5BI/vXxb7Ksf6fqPujGtlGduSmZi22Lk00hMlAzL9nUympiUVIstt6pyfDOzi9v1enK4YzH2zzGjxp/6xSJYPMHKnOQ1zqKMRfMSJv/dxS12xPO49KO6QvaQCW4fbf3errZoKDaM8FTYYIrlgQ==", "traceTime": "0429133649", "accessType": "0", "settleDate": "0429", "signMethod": "01", "txnSubType": "01", "origRespMsg": "持卡人身份信息、手机号或CVN2输入不正确,验证失败[1000005]", "currencyCode": "156", "origRespCode": "66", "issuerIdentifyMode": "0", "settleCurrencyCode": "156" }
其中,respCode等于00,但是origRespMsg显示支付出错,其实这是没有支付成功的,是否应该判断一下origRespCode?
Hi,
$gateway->setEnvironment('production');
使用正式环境,验证付款成功后
回调的签名签名验证出错了:
UpopRsaCert.cer 无法打开。
openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate!
用openssl命令行 也无法读取这个文件。。
然而,银联的help上说用不到UpopRsaCert.cer这个文件,可以删除。
下载的正式环境证书目录里有3个文件:
EbppRsaCert.cer , encryptpub.cer, UpopRsaCert.cer
然而,下载的正式环境证书的帮助里写:
ebpp.cer 生产验签证书
encryptpub.cer 生产加密证书
已经搞不清这些了。。求帮助。
在网关设置中,certPath 和 certDir 是从哪里来的?
嗨,@lokielse ,你好。
关于 issue #11 ,排查过程有些艰难,(maybe just for my only),因此,如果在以下文件:
omnipay-unionpay/src/Helper.php
里的 sendHttpRequest
方法中,添加以下代码行:
if (curl_error($ch)) {
throw new \RuntimeException(curl_error($ch));
}
因为,curl如果发生错误,只会返回false结果,用户层不知在哪里返回的false,唯有沿着代码调用栈层层往上debug。
没有v0.3.8的分支,v0.4.x也不再使用这个方法,因此我不知道怎么发PR。
我看readme中说for PHP 5.3+,但是该项目引用了guzzle,和symfony的http-foundation,都是要求7.1以上,不然跑不起来。。
原文
$response = $gateway->Omnipay::queryStatus([
应该是
$response = $gateway->query([
不然,会丢出一个错误。
根据您此项目中的 退款,需要的参数是:'orderId', 'txnTime', 'txnAmt'
但是,调用refund()方法时,出现下面异常:
/data/www/benefits-platform/vendor/lokielse/omnipay-
unionpay/src/Message/ExpressRefundRequest.php(22): Omnipa
y\Common\Message\AbstractRequest->validate('orderId', 'txnTime', 'txnAmt', 'queryId')
需要4个参数的不是undo(撤销)方法吗?
嗨, @lokielse 。
我在执行$gateway->purchase()->send()
时,返回结果为false。通过排查追踪,发现在sendHttpRequest方法中出现错误,用curl_error($ch)得到这个提示信息。
OpenSSL was built without SSLv3 support
这个猜测是我的环境关于openssl的安装有问题,我需要再查一下资料。
如果升级到 v0.4.0,代码一点不动,可以收到正常的结果,也可以成功付款,但是在回调时验证签名失败。我不知道如何去排查。我用的是在v0.3.8下的配置方法,没有按照新的README上所说的设置公钥,私钥及证书ID,是不是这个原因呢?
您好,我看到文档说使用分期付款时 txnSubType = 03 ,可我在您的源码(ExpressPurchaseRequest.php)中看到您把这 txnSubType = 01 写死在代码中,意思是说现在这个包还不支持分期付款吗?
请问下作者,现在的这个支付就只是银联的PC和wap的支付接口,没有银联的无跳转支付这个产品的方法吗
如果没有,能否考虑添加上去呢
测试时,同步通知和异步通知,都返回 respCode = 00,但是经过 Singer->verifyWithRSA() 验证签名时,同步失败!!异步成功!!导致同步的 verify_success = false,is_paid() 调用返回失败!
大家有没有遇到类似的问题!
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.