PayPal IPN Simulator Custom Text Fields - php

I have the following PayPal button set up:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="SN3834XQZMRCW">
<table>
<tr><td><input type="hidden" name="on0" value="Minecraft Username:">Minecraft Username:</td></tr>
<tr><td><input type="text" name="os0" maxlength="200"></td></tr>
<tr><td><input type="hidden" name="on1" value="TeamSpeak UID:">TeamSpeak UID:</td></tr>
<tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</table>
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
According to the documentation, the two hidden fields I have simply get passed to PayPal and then back to my PHP script. To get these values, would it be correct to use the following:
$_POST['TeamSpeak UID:'];
Before you ask, I can't seem to send these custom fields using the simulator, unless the fields are encapsulated within the custom field? The documentation and help seems to be lacking here. Thanks for any help.

Related

I am trying to get custom date to pass to PayPal

I am trying to get this line of product info here to pass into PayPal form using the custom varible <input type="hidden" name="custom" value="SansburyTech|Purchase of a ToolCart|Dewalt Roller|SKU:164604646|Cost:163.50"> but its not happening?
Is there something I am doing wrong or overlooking? Here on PayPalDocs it says specifically: The following are pass-through variables: custom or item_number or item_number_x or invoice
Here is my complete HTML Paypal form as an example;
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="margin:0;padding:0;" target="PayPal">
<input type="hidden" name="business" value="">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Toolcart">
<input type="hidden" name="item_number" value="Dewalt Roller">
<input
type="hidden"
name="custom"
value="SansburyTech|Purchase of a ToolCart|Dewalt Roller|SKU:164604646|Cost:163.50">
<input type="hidden" name="amount" value="244.50">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="receiver_email" value="">
<input type="hidden" name="return" value="https://toolcart.info/pickup">
<input type="hidden" name="no_note" value="0">
<input type="image" src="/wp-content/themes/toolcart-theme/images/paypal.png" class="img-fluid" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Will be incredibly grateful for any answers!
~ Thank-you!
Converting my comment to an answer (for that sweet sweet karma).
The OP was looking for the custom variable to appear in the PayPal-generated e-mail messages that get sent back to the merchant account-holder (or to the customer). This won't work because PayPal does not include the custom variable in any e-mail messages: it's only included in IPN messages.
Usually the best solution is to pass only a unique identifier and store the rest in own your database.
But if you must pass multiple values in the arbitrary custom field, the pipes in your example seem problematic. Use base64 encoding or a different delimiter--JSON format is a common choice here, then you can simply decode it into an array when receiving the IPN.

Error on Buy Button (Paypal Integration Gateway in CodeIgniter)

I'm using a CodeIgniter 3 and I'm having a hard time on implementing the paypal integration on my website . For now I'm trying it on the sandbox and followed this tutorial Paypal Integration Using CodeIgniter
Now the problem here is on my
views/products/index.php
<a href="<?php echo base_url().'products/buy/'.$product['id']; ?>">
<img src="<?php echo base_url(); ?>assets/images/x-click-but01.gif" style="width: 70px;">
</a>
Now when i click the button Paypal Buy Now now it
redirects me to
products/buy/1 was not found on this server.
I follow the instruction
and here is what on my database
Then i tried using the paypal button
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="S3RE65SMVGAHC">
<input type="image" src="https://www.sandbox.paypal.com/en_GB/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
and it redirects me to paypal but without the prices that i inputted on my database. SOMEONE HELP ME PLEASE
The error message
products/buy/1 was not found on this server.
is saying that the controller Products.php was not found.
Assuming the file is in the `applications/controllers' directory (it should be) then you need to make sure that the file name starts with an uppercase 'P'. In other words, the file name should be Products.php not products.php
Please try below sample codes.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="YOUR_ACCOUNT_EMAIL/MERCHANTID">
<input type="hidden" name="item_name" value="test">
<input type="hidden" name="amount" value="10">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online.">
</form>
And refer to below link for details of each variable.
https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/

How to protect user edit paypal button ?

How to protect user edit paypal button ?
this is paypal buy now button on my site
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="me#mybusiness.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Teddy Bear">
<input type="hidden" name="amount" value="12.99">
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
my customer will edit paypal button like currency_code, amount
i want to know , how can i protect user to edit paypal button ?
Log into your PayPal account and use the button tool to create a saved button. the saved button replaces all of the sensitive data in the button code with a "Hosted button ID. here is an example of the hosted button code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="L7NSNLBNU69AC">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

PayPal IPN returning full php ascii code instead of just a numeric value

So I'm passing a custom value to PayPal:
<input type="hidden" name="custom" value="<?php echo $id; ?>">
However when it's returning the custom variable back it sometimes returns it as:
EITHER THIS: custom=%3C%3Fphp+echo+9445%3B+%3F%3E
OR THIS: 2. custom=9445
It's random. Sometimes it returns it properly (custom=9445) and other times it returns it as %3C%3Fphp+echo+9445%3B+%3F%3E. Which messes up the other functions while storing into the database and correlating it to a certain user. Am I missing something? Did I do something wrong?
Full form code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXXXXXXXXX">
<input type="hidden" name="custom" value="<?php echo $id; ?>">
<input type="image" src="http://www.XXXXXX.com/XXX/XXXX/XXXXXX.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

How do I validate paypal form with php data before submitting it to paypal

I have the following form
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="N8Q3XBTNBV8TY">
<table>
<tr><td><input type="hidden" name="on0" value="Team Name">Team Name</td></tr><tr><td><input type="text" name="os0" maxlength="200"></td></tr>
</table>
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
I want to validate (using php) that the team name is at least three characters long before the form is submitted. How would I implement this?
You can't (if you're submitting directly to PayPal, as you are in your code example), using PHP. But you can use javascript.
<script>
// using jQuery, just cuz it's easier for this sort of stuff
$('form[action*="paypal"]').submit(function(event) {
if ($('input[name="on0"]').val().length < 3) {
event.preventDefault();
// alert, or use some other means of displaying an error to the user
alert('Your Team Name must be at least 3 characters long');
return false;
}
});
</script>

Categories