PHP Echo a value to Paypal (Encrypted)
up vote
1
down vote
favorite
I'm creating a custom checkout page that then heads to the paypal site for payment, i have successfully sent the correct info to paypal using this:
<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>
and it is working great... the only problem is, I got no idea how to have it encrypted so people cant just Ctrl-Shift-I it and change it to $0.
I know how to create an encrypted PayPal button but only with a set price, name etc... So if anyone can point me in the right direction on the best way to do this is or can help me out that would be great. Thanks for any help :)
php html forms encryption paypal
add a comment |
up vote
1
down vote
favorite
I'm creating a custom checkout page that then heads to the paypal site for payment, i have successfully sent the correct info to paypal using this:
<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>
and it is working great... the only problem is, I got no idea how to have it encrypted so people cant just Ctrl-Shift-I it and change it to $0.
I know how to create an encrypted PayPal button but only with a set price, name etc... So if anyone can point me in the right direction on the best way to do this is or can help me out that would be great. Thanks for any help :)
php html forms encryption paypal
1
You could create 2 different pages. One with the form containing an "item_id", then another php script that receives that item_id and sends to PayPal the cURL request with the corresponding informations of that item_id. Then you can redirect the user to the PayPal page that you have got from the cURL response. This way users cannot edit the informations you submit to PayPal as you are doing it server side and the only information they see is the item_id.
– J0ker98
Nov 10 at 11:24
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm creating a custom checkout page that then heads to the paypal site for payment, i have successfully sent the correct info to paypal using this:
<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>
and it is working great... the only problem is, I got no idea how to have it encrypted so people cant just Ctrl-Shift-I it and change it to $0.
I know how to create an encrypted PayPal button but only with a set price, name etc... So if anyone can point me in the right direction on the best way to do this is or can help me out that would be great. Thanks for any help :)
php html forms encryption paypal
I'm creating a custom checkout page that then heads to the paypal site for payment, i have successfully sent the correct info to paypal using this:
<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>
and it is working great... the only problem is, I got no idea how to have it encrypted so people cant just Ctrl-Shift-I it and change it to $0.
I know how to create an encrypted PayPal button but only with a set price, name etc... So if anyone can point me in the right direction on the best way to do this is or can help me out that would be great. Thanks for any help :)
<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>
<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>
php html forms encryption paypal
php html forms encryption paypal
edited Nov 10 at 11:22
eibersji
427420
427420
asked Nov 10 at 11:11
RedstoneMaina
87
87
1
You could create 2 different pages. One with the form containing an "item_id", then another php script that receives that item_id and sends to PayPal the cURL request with the corresponding informations of that item_id. Then you can redirect the user to the PayPal page that you have got from the cURL response. This way users cannot edit the informations you submit to PayPal as you are doing it server side and the only information they see is the item_id.
– J0ker98
Nov 10 at 11:24
add a comment |
1
You could create 2 different pages. One with the form containing an "item_id", then another php script that receives that item_id and sends to PayPal the cURL request with the corresponding informations of that item_id. Then you can redirect the user to the PayPal page that you have got from the cURL response. This way users cannot edit the informations you submit to PayPal as you are doing it server side and the only information they see is the item_id.
– J0ker98
Nov 10 at 11:24
1
1
You could create 2 different pages. One with the form containing an "item_id", then another php script that receives that item_id and sends to PayPal the cURL request with the corresponding informations of that item_id. Then you can redirect the user to the PayPal page that you have got from the cURL response. This way users cannot edit the informations you submit to PayPal as you are doing it server side and the only information they see is the item_id.
– J0ker98
Nov 10 at 11:24
You could create 2 different pages. One with the form containing an "item_id", then another php script that receives that item_id and sends to PayPal the cURL request with the corresponding informations of that item_id. Then you can redirect the user to the PayPal page that you have got from the cURL response. This way users cannot edit the informations you submit to PayPal as you are doing it server side and the only information they see is the item_id.
– J0ker98
Nov 10 at 11:24
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238356%2fphp-echo-a-value-to-paypal-encrypted%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
You could create 2 different pages. One with the form containing an "item_id", then another php script that receives that item_id and sends to PayPal the cURL request with the corresponding informations of that item_id. Then you can redirect the user to the PayPal page that you have got from the cURL response. This way users cannot edit the informations you submit to PayPal as you are doing it server side and the only information they see is the item_id.
– J0ker98
Nov 10 at 11:24