PHP向Paypal回显一个值(已加密)

时间:2018-11-10 11:11:08

标签: php html forms encryption paypal

我正在创建一个自定义结帐页面,然后转到贝宝网站进行付款,我已使用以下方法成功将正确的信息发送给贝宝:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="I@AmNotPostingMyRealEmail.com">
<input type="hidden" name="currency_code" value="AUD">
<?php $cart = $_SESSION['cart']; ?>
<?php $total = 0;
$count = 0;
foreach ($cart as $key => $value) {
$navcartsql = "SELECT * FROM products WHERE id=$key";
$navcartres = mysqli_query($connection, $navcartsql);
$navcartr = mysqli_fetch_assoc($navcartres); ?>
<?php if ($value['Extras']==""){
			$Extra =  0;} else{$Extra = 2;} 
		if ($value['ExtrasB']==""){
		   $Extri =  0;} else{$Extri = 2;} 
		if ($value['Sauce']=="" or $value['Sauce']=="No-Sauce"){
			$Extra1 = 0;} else{$Extra1 = 0.5;} 
		if ($value['Addons']==""){
			$Addi = 0;} else{$Addi = 1;} 
		if ($value['AddonsB']==""){
		$Addo = 0;} else{$Addo = 1;} 
		 $subtotal = ($Extri+$Addi+$Addo+$Extra1+$Extra+$navcartr['price']); ?>
<?php $count++; ?>
<input type="hidden" name="item_name_<?php echo $count;?>" value="<?php echo $navcartr['name']; ?>">
<input type="hidden" name="amount_<?php echo $count;?>" value="<?php echo $subtotal;?>">
<input type="hidden" name="quantity_<?php echo $count;?>" value="<?php echo $value['quantity']; ?>">
<input type="hidden" name="on0_<?php echo $count;?>" value="Sauce">
<input type="hidden" name="os0_<?php echo $count;?>" value="<?php echo $value['Sauce']; ?>">
<input type="hidden" name="on1_<?php echo $count;?>" value="Extras">
<input type="hidden" name="os1_<?php echo $count;?>" value="<?php echo $value['Extras']; echo ", "; ?><?php echo $value['ExtrasB']; ?>">
<input type="hidden" name="on2_<?php echo $count;?>" value="Addon's">
<input type="hidden" name="os2_<?php echo $count;?>" value="<?php echo $value['Addons']; echo ", "; echo $value['AddonsB']; ?>">
<?php } ?>

<button type="submit" class="button btn-lg">Pay Now: Paypal/Card</button>
</form>

它工作得很好...唯一的问题是,我不知道如何对其进行加密,因此人们不能仅按Ctrl-Shift-I并将其更改为$ 0。 我知道如何创建一个加密的PayPal按钮,但只能设置一个固定的价格,名称等。因此,如果有人能以正确的方式指出正确的方向,这将是一个好方法,或者可以帮助我,那就太好了。感谢您的帮助:)

0 个答案:

没有答案