我曾尝试整合 payumoney 支付网关。我有一个页面 cart.php 并且我已经完成了以下代码:
if(isset($_POST['image-pay']){
$MERCHANT_KEY = "rjQUPktU";
$SALT = "e5iIg1jwi8";
$PAYU_BASE_URL = "https://test.payu.in";
$action = '';
$key = $MERCHANT_KEY;
$txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);
$productinfo = 'photos';
$firstname = $_POST['firstname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$success_url = 'http://example.com/checkout/final-success.php';
$failure_url = 'http://example.com/checkout/failure.php';
$cancel_url = 'http://example.com/checkout/cancel.php';
$service_provider = "payu_paisa";
$hash = '';
$hasTemp = $key."|".$txnid."|".$amount."|".$productinfo."|".$firstname."|".$email."|||||||||||".$SALT;
$hash = strtolower(hash('sha512', $hasTemp));
$action = $PAYU_BASE_URL . '/_payment';
}
<form action="<?php echo $action; ?>" method="post" name="payuForm" id="jps_payuform">
<input type="hidden" name="key" value="<?php echo $MERCHANT_KEY; ?>" />
<input type="hidden" name="hash" value="<?php echo $hash; ?>"/>
<input type="hidden" name="hash_temp" value="<?php echo $hasTemp; ?>"/>
<input type="hidden" name="txnid" value="<?php echo $txnid; ?>" />
<input type="hidden" name="amount" value="<?php echo $amount; ?>" />
<input type="hidden" name="surl" value="<?php echo $success_url; ?>" size="64" />
<input type="hidden" name="furl" value="<?php echo $failure_url; ?>" size="64" />
<input type ="hidden" name="curl" value="<?php echo $cancel_url; ?>" />
<input type="hidden" name="service_provider" value="<?php echo $service_provider; ?>" size="64" />
<input type="hidden" name="productinfo" value="<?php echo $productinfo; ?>" />
<input type="hidden" name="udf1" value="<?php echo $numberPics; ?>" />
<h3 class="att_heading" style="text-align: center;">Your Personal Details</h3>
<label><span class="required_jps_field">*</span> Mandatory Parameters</b></label>
<label><span class="required_jps_field">*</span> Name: </label>
<input name="firstname" class="form-control" value="<?php echo $firstname; ?>" required />
<label><span class="required_jps_field">*</span> Email:</label>
<input name="email" id="email" class="form-control" value="<?php echo $email; ?>" required />
<label><span class="required_jps_field">*</span> Phone: </label>
<input name="phone" class="form-control" value="<?php echo $phone; ?>" required />
<input type="submit" class="btn btn-info" name="image-pay" value="Process" />
</form>
它工作正常,但问题是当我使用 isset($_POST['image-pay']) 函数时,我必须在提交按钮上单击两次,然后它重定向 payumoney 页面,如果我删除它(isset($_POST['image -pay']) 功能然后提交按钮在单击时工作,但它不会将姓名、电子邮件和电话传递给 payumoney。
请帮助并告诉我我在哪里做错了?