Paypal Buy Now button transaction response issue - paypal

I am using the following code to generate a "Buy Now" button for selling a single item.
It takes me to PayPal using the sandbox and does the payment but after I return nothing is received in the response (there is no extra parameter in the URL I get).
<form name="_xclick" action="https://www.sandbox.paypal.com/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="steve.johntestemail#gmail.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Book_1">
<input type="hidden" name="amount" value="0.09">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="return" value="http://www.thequeenoflean.com.au">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
</form>
Will I get the data in get or post?
Actually I want to retrieve the email of the buyer and some other information as well.
Can anyone guide me what my mistake is here?
Thanks in advance.

i tried sandbox, live Paypal payment scenario but it was not working,
i tried so many tutorials but the steps mentioned in those tutorials were not working,
finally i got the reason:
i was trying to use Paypal from asian country where it is not supported and works abnormally,and that's why i was not getting response in return. if you use any other VPN with for example(american, Australian etc.. ips where it is supported) it will work fine and return you response accurately.
Thanks,

I know a reason why you're not getting any information.
take a look here: https://stackoverflow.com/a/11404356/279147
you see I have a notify_url parameter in my form, this is a url which will be called by paypal when the payment has been completed, whether it succeeds or fails.
the url is not opened by the browser, popups, etc, it's a "back channel" call to your server to just send data, there is no interaction with the client, so don't put any html, or return anything, it's just a "dead drop" url to dump data, if you put something like
<?php trigger_error(print_r($_POST,true)); ?>
in your code, your error log might show up some information, so then you know you are receiving information,
you're missing that, so you never get any information, unless the user clicks on the return to website button and in my experience that never happens. they just close the browser.
so take a look at my url, add the parameter and then try to do it again.

Related

Why would paypal notification URL different

Okay, so we have a member site using Joomla, and a component that allows users to perform certain tasks (creating teams). They are allowed to login, and create a team, but they can't add members to this team until they pay a $25.00 fee.
This happens through Paypal IPN. There is essentially this form below... (some personal data removed).
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="<?php echo $item_name;?>">
<input type="hidden" name="business" value="blah#blah.com">
<input type="hidden" name="amount" value="25">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="no_note" value="1">
<!--<input name="userId" value="<?php //echo $user->id;?>" type="hidden">-->
<!--<input name="task" value="paypal_register" type="hidden">-->
<input type="hidden" name="currency_code" value="USD">
<!-- Enable override of buyers's address stored with PayPal . -->
<!-- Set variables that override the address stored with PayPal. -->
<input type="hidden" name="return" value="<?php echo JURI::ROOT().'index.php?option=com_fastball&view=payment&task=paypal_register';?>">
<input type="hidden" name="notify_url" value="<?php echo JURI::ROOT().'index.php?option=com_fastball&view=payment&task=paypal_register&userId='.$user->id.'&ipn=1';?>">
<!--<input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">-->
</form>
Now sometimes the IPN redirects and works just fine. But other times it cuts the url short from "index.php?option=com_fastball&view=payment&task=paypal_register&userId=" to "index.php?option=com_fastball", therefore not activating the view in Joomla that contains the code to update the database on notification.
It seems fairly random. There are several scenarios, 1 - New User Creating New Team. 2 - Old User Creating New Team. 3- Old User Renewing Old Team.
But regardless of that, they ALL hit this payment form button with THESE notify URL as hidden input.
So I'm not sure where paypal is either A.) Getting the shortened URL, or B.) They are cutting it short for some reason. It returns to the shortened URL with all of the Paypal Post info showing in the URL Parameters (&st=Completed&amt=25.00 etc from paypals servers)
This has been extremely frustrating and I may not have explained it well so if you have any questions or thoughts, just let me know. Thanks!
For URL paths you should use JURI::base() not JURI::ROOT. You can check the documentation here https://docs.joomla.org/Constants.
This appears to be a recent PayPal problem. All the urls (return, cancel_return, and notify_url) PayPal is stripping the url of all content after the first '&'.
Note also that the issue appears to be intermittent; it may be dependent on the PayPal server you connect to (QueryString values removed from the IPN endpoint by PayPal).
I have made some modifications to my own PayPal form replacing just the '&' with '&' (the encoded version) and that seems to work.

How to capture form info with PayPal transaction

I'm offering a backlink building service and I'd like to just offer a simple form on my site where the user can enter their:
Website they want me to rank
And 1-2 keywords they're looking to rank for
And then a simple PayPal button that directs them to where they can pay.
Does anyone have any resources they can point me to to capture that information, maybe even their PayPal email, once they make a purchase?
Are there any plugins or code anyone knows of that I can just swipe and modify with my form fields?
I know this has to be possible I just don't know what to type into Google to get more information.
Thanks in advance.
Basically there are two parameters that comes to my mind that you could use custom & no_note
custom is a parameter that you can use to collect the Website they want me to rank information and regarding keywords you can use no_note(but this has to be entered by the buyer in PayPal checkout page.Alternaltively, you can use `custom' parameter to append both the information and then make a payment.
Sample Form Code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="XXX#gmail.com">
<input type="hidden" name="item_name" value="test">
<input type="hidden" name="amount" value="1.00">
<input type="hidden" name="custom" value="website_rank+keywords">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="paymentaction" value="sale">
<input type="image" src="https://www.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.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Now, how to get this information after the buyer completes the
payment?
Use Instant Payment notification. and look at the IPN variables that you can get back

Paypal - Dynamic Buy button to charge our clients customer

I need to implement a method where we can allow a clients customer to make a payment to the client via our website - all of which will be setup via our custom CMS.
Our initial plan was to use the following form script to generate a transaction and ask the client to add a return address to our website.
<form name="_xclick" action="https://www.paypal.com/uk/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="someone#someon.com">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="item_name" value="2 x sessions">
<input type="hidden" name="amount" value="50">
<input type="image" class="btn btn-default nom paypalBtn" src="" border="0" name="submit" alt="£50">
</form>
This would potentially work fine - as we could dynamically add the value, business email and item name. Though we are worried that any web savvy person could simply inspect the form in a browser and change the payment value to a more pleasing figure! So we feel we need a better solution.
Does anyone have any suggestions for a cleaner solution?
Log into your PayPal account, click on Merchant Services at the top of the page and then click one Create Payment Buttons for your website. When you create buttons on PayPal they are hosted and secure.

Paypal IPN won't work?

I have been trying to make a working ipn for my website. Here's the code:
Have tested this through real PayPal.
My Button:
<form method="post" name="paypalConfirm" action="http://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="rm" value="2"/>
<input type="hidden" name="cmd" value="_xclick"/>
<input type="hidden" name="custom" value="username">
<input type="hidden" name="business" value="email"/>
<input type="hidden" name="item_name" value="Item"/>
<input type="hidden" name="amount" value="0.02"/>
<input type="image" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
I have tested these several times but it just won't work. If anybody could help me, please do.
You need to make sure you have IPN configured in the PayPal account that is receiving the payment.
If you do have it configured and you don't think you're getting an IPN check the IPN History in your PayPal account. This will show you whether or not anything is getting sent and what response your server is sending back. It's possible the IPN's are getting sent but your script is simply failing.
You'll need to check your web server logs to see what the error is if that's the case, or what I like to do is setup a basic HTML form with the action set to my IPN URL. I include hidden fields that match what I expect to get from an IPN, and then I load this in a browser and submit it. This allows me to see the result on screen which helps with debugging. Once it's all working there you know it'll work when PayPal sends it.
Keep in mind if testing that way the IPN will not verify with PayPal since the data didn't come from them, so you'll need to make sure your code logic handles that accordingly.

Paypal SetExpressCheckout won't return to "RETURN URL"

I'm trying to set up a paypal solution but i'm having some trouble with the RETURNURL.
My form looks like this.
<form method="post" action="https://api-3t.paypal.com/nvp">
<input type="hidden" name="USER" value="<%=PayPal_API_Username%>">
<input type="hidden" name="PWD" value="<%=PayPal_API_Password%>">
<input type="hidden" name="SIGNATURE" value="<%=PayPal_API_Signature%>">
<input type="hidden" name="VERSION" value="65.0">
<input type="hidden" name="PAYMENTREQUEST_0_PAYMENTACTION" value="Sale">
<input type="hidden" name="PAYMENTREQUEST_0_CURRENCYCODE" value="DKK">
<input type="text" name="PAYMENTREQUEST_0_AMT" value="<%=Amount%>.00">
<input type="hidden" name="CUSTOM" value="<%=GUID%>">
<input type="hidden" name="RETURNURL" value="http://<%=c_mainDomain%>/return.html">
<input type="hidden" name="CANCELURL" value="http://<%=c_mainDomain%>/cancel.html">
<input type="hidden" name="METHOD" value="SetExpressCheckout">
<input type="submit" name="submit" value="Videre til betaling med Paypal">
</form>
When i submit the form it goes to "https://api-3t.paypal.com/nvp" and shows the message below.
TOKEN=EC%2d2XR31554RN094031R&TIMESTAMP=2012%2d01%2d03T10%3a23%3a11Z&CORRELATIONID=a0c80a35bfde2&ACK=Success&VERSION=65%2e0&BUILD=2271164
Shouldn't it send me back to my own page, to the "RETURNURL"? or is there something i'm missing
Yeah, I'm pretty sure, that my comment was right.
This POST should be done by your web app server - transient to the client.
Just before the user clicks the 'pay' button (when you render the site) on your web app - you call the setExpressCheckout, then you read the token from the answer and apply it to the button.
Then after the user clicks he is redirected to paypal site and returns to your page by returnURL.
Please make sure you exactly understand the whole process. Giving too much information to your users may be a potential vulnerability to your payments module.
EDIT: I guess that the form you've created is from PayPal's tutorial. Please notice that it is for testing and understanding the whole process only.