我在laravel 5.5上整合了PayuMoney。在payumoeny仪表板面板上支付成功,但是当成功功能返回时," PayuMomeny返回无效交易。请再试一次"。
成功函数
public function payumoneyPaymentSuccess(Request $request)
{
$status = $request->status;
$firstname = $request->firstname;
$amount = $request->amount;
$txnid = $request->txnid;
$posted_hash = $request->hash;
$key = $request->key;
$productinfo = $request->productinfo;
$email = $request->email;
/*get salt*/
$payumoneySetting = parent::getPaymentSetting();
$payumoney = json_decode($payumoneySetting['PayUMoney'],true);
$MERCHANT_KEY = $payumoney['Merchant_Key'];
$SALT = $payumoney['Merchant_Salt'];
$salt = $SALT;
//salt value is correct here
// Salt should be same Post Request
If (isset($_POST["additionalCharges"])) {
$additionalCharges=$_POST["additionalCharges"];
$retHashSeq = $additionalCharges.'|'.$salt.'|'.$status.'|||||||||||'.$email.'|'.$firstname.'|'.$productinfo.'|'.$amount.'|'.$txnid.'|'.$key;
} else {
$retHashSeq = $salt.'|'.$status.'|||||||||||'.$email.'|'.$firstname.'|'.$productinfo.'|'.$amount.'|'.$txnid.'|'.$key;
}
$hash = hash("sha512", $retHashSeq);
if ($hash != $posted_hash) {
echo "Invalid Transaction. Please try again";
} else {
echo "<h3>Thank You. Your order status is ". $status .".</h3>";
echo "<h4>Your Transaction ID for this transaction is ".$txnid.".</h4>";
echo "<h4>We have received a payment of Rs. " . $amount . ". Your order will soon be shipped.</h4>";
}
}