我在PayFast上遇到了一些问题。我是新手,我想在用户成功付款后将用户数据添加到数据库。这是我的用户数据表格。非常感谢您的帮助!
<form name="payment" class="form-inline w3-padding w3-light-grey" method="post" action="https://www.payfast.co.za/eng/process" onsubmit="return validateAmount()">
<?php while($row = mysqli_fetch_array($user_rec)){ ?>
<input type="hidden" name="merchant_id" value="12631778"/>
<input type="hidden" name="merchant_key" value="wcnt1rtsa8g49"/>
<input type="hidden" name="return_url" value="https://www.capribank.com/das/donations.php"/>
<input type="hidden" name="cancel_url" value="https://www.capribank.com/dep/cancel.php"/>
<input type="hidden" name="notify_url" value="https://www.capribank.com"/>
<input type="hidden" name="name_first" value="<?php
echo $row['name'];
?>"/>
<input type="hidden" name="name_last" value="<?php
echo $row['surname'];
?>"/>
<input type="hidden" name="email_address" value="
<?php
echo $row['email'];
?>">
<input type="hidden" name="cell_number" value="
<?php
echo $row['phone'];
?>">
<input type="hidden" name="m_payment_id" value="<?php
$digits = 4;
echo "CPC".str_pad(rand(0, pow(10, $digits)-1), $digits, '0', STR_PAD_LEFT); ?>"/>
<input type="hidden" name="item_description" value="Days - Investment Period"/>
<input type="hidden" name="custom_int1" value="2"/>
<input type="hidden" name="custom_str1" value="Extra order information"/>
<input type="hidden" name="email_confirmation" value="1">
<input type="hidden" name="confirmation_address" value="<?php
echo $row['email'];
?>">
<?php } ?>
<input type="hidden" name="payment_method" value="eft">
<div class="form-group">
Enter amount <input type="text" min="200" class="form-control" name="amount" required="" size="10"/>
</div>
<div class="form-group">
<select name="item_name" class="form-control">
<option value="2 Months - Investment Period">2 Months </option>
<option value="4 Months - Investment Period">4 Months </option>
<option value="6 Months - Investment Period">6 Months </option>
<option value="8 Months - Investment Period">8 Months </option>
<option value="10 Months - Investment Period">10 Months </option>
<option value="12 Months - Investment Period">12 Months </option>
</select>
</div>
<div class="form-group">
<button name="send" class="w3-btn w3-amber w3-round-large"><strong>Pay Now</strong></button>
</div>
</form>
答案 0 :(得分:0)
这是payFast的指南请关注它,他们已经提到了
所有数据都返回给notify_url而不是return_url,所以编写一个函数将事务详细信息添加到Database 您将获得返回的变量,这将有助于您确定事务是否未能成功