百度收银台接口php,百度收银台-通知支付成功接口【rsa签名错误】

//返回的全部参数

Array

(

[unitPrice] => 1

[orderId] => 81245245184095

[payTime] => 1569117532

[dealId] => 3574001498

[tpOrderId] => 201909220958408776

[count] => 1

[totalMoney] => 1

[hbBalanceMoney] => 0

[userId] => 1443238249

[promoMoney] => 0

[promoDetail] =>

[hbMoney] => 0

[giftCardMoney] => 0

[payMoney] => 1

[payType] => 1087

[returnData] => {"bizKey1":"0.01","bizKey2":"201909220958408776"}

[partnerId] => 0

[rsaSign] => Xjk8o3s5Jkib5aAmenu2zo/pqedTSbrN1I0iCcvbUrsRhzcjzDaoG5ddGe2Kkj1xlOuePG6LRc/Rp4rqgFz0ytenacOCkDHi2SXhELPgQDhhDtXCD/PgPXFBfaNIA70ASRSpPnXvRwpjUbWIiDjDigmV37icTP1qnwtRUpmfTX8=

[status] => 2

)

//去除rsaSign后的参数

Array

(

[unitPrice] => 1

[orderId] => 81245245184095

[payTime] => 1569117532

[dealId] => 3574001498

[tpOrderId] => 201909220958408776

[count] => 1

[totalMoney] => 1

[hbBalanceMoney] => 0

[userId] => 1443238249

[promoMoney] => 0

[promoDetail] =>

[hbMoney] => 0

[giftCardMoney] => 0

[payMoney] => 1

[payType] => 1087

[returnData] => {"bizKey1":"0.01","bizKey2":"201909220958408776"}

[partnerId] => 0

[status] => 2

)

//重新签名

dfMOLPin4+5L/DzPnkwhqDzxAdeELa3eRlH1dn0SUPUyUPY5Ui7tdAwSsXxnUn435c+WAdBq7miL1LmZjD/t6ZgivFxXSLEvSc/kp0eUgZ07lA7+gJLoQj/l17/U76sB4Q1AOb3YFZOf0OH2EJGRGx+k2Oy8G1VnR8RpNzI8qZE=

代码也是用的官方提供的sdk,发起支付这些步骤都正常:

$temp = json_decode($post,true);

print_r($temp);

$returnData = json_decode($temp["returnData"],true);

foreach ($returnData as $key => &$value) {

$value = urlencode($value);

}

$temp["returnData"] = json_encode($returnData);

// echo(mb_detect_encoding($temp["returnData"],['UTF-8']));

// unset($temp["returnData"]);

$rsaSign = $temp["rsaSign"];

unset($temp["rsaSign"]);

echo "\n";

print_r($temp);

// 第一步:获取签名和支付参数

import('nomi.Autoloader', EXTEND_PATH);

$rsaPrivateKeyFilePath = 'rsa/rsa_private_key.pem';

$rsaPublicKeyFilePath = 'rsa/rsa_public_key.pem';

if( !file_exists($rsaPrivateKeyFilePath) || !is_readable($rsaPrivateKeyFilePath) ||

!file_exists($rsaPublicKeyFilePath) || !is_readable($rsaPublicKeyFilePath) ){

return false;

}

$rsaPrivateKeyStr = file_get_contents($rsaPrivateKeyFilePath);

$rsaPublicKeyStr = file_get_contents($rsaPublicKeyFilePath);

$requestParamsArr = $temp;

$requestParamsArr['sign'] = $rsaSign;

$checkSignRes = \NuomiRsaSign::checkSignWithRsa($requestParamsArr, $rsaPublicKeyStr);

var_dump($checkSignRes);

$rsaSign = \NuomiRsaSign::genSignWithRsa($requestParamsArr, $rsaPrivateKeyStr);

echo $rsaSign;

echo "\n";

$requestParamsArr['sign'] = $rsaSign;

$checkSignRes = \NuomiRsaSign::checkSignWithRsa($requestParamsArr, $rsaPublicKeyStr);

var_dump($checkSignRes);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值