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 :)










share|improve this question



















  • 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















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 :)










share|improve this question



















  • 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













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 :)










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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













  • 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


















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














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














































































這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3