PayPal ipnNotificationUrl - paypal

When a customer clicks on my Pay Now button I already have the ID of the transaction. So I do it like this;
<input type="hidden" name="return" value="successurl.php?id=1234567890">
<input type="hidden" name="cancel_return" value="failureurl.php?id=1234567890">
<input type="hidden" name="ipnNotificationUrl" value="ipnurl.php?id=1234567890">
The first two lines work OK, but PayPal doesn't call the ipn url on the third line. Anyone knows why? (Unfortanatly no answer from PayPal :( )

The field name for that is notify_url, not ipnNotificationUrl.

Related

Paypal: trying to pass an amount with a Donation button

I have a Donate button set up for the user to enter the donation amount. I am trying to send an amount with the button. I can enter amount=1.00 in the Add Advanced Variables in the button setup - that works fine. However, I have had no success sending the amount as part of the URL. I have added the following line to the PayPal button form:
<input type="hidden" name="amount" value="9.99" />
but the amount field is blank when I get to PayPal. Any thoughts what I am doing wrong?
If you're creating a so called 'hosted button' (that is, a button where the button details are stored on the PayPal side), then the 'amount' POST parameter is ignored for requests to https://www.paypal.com/cgi-bin/webscr.
This is a security feature to prevent people from being able to manipulate the amount passed to PayPal for checkout.
You can identify whether you're using a hosted button by the following data;
Hosted buttons will have a value for cmd of _s-xclick and include the hosted_button_id parameter.
If this is the case, you cannot update the amount by passing in an extra amount POST parameter.
However, because you're dealing with donations and the amount is flexible by definition, you don't in fact need a 'hosted button'.
In the button creation form, turn off 'Host button with PayPal', or write your own to point to PayPal.
If you do this, you can set the amount via the amount POST parameter.
For example, the below works fine;
<form method="POST" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_donations">
<label for="amount">Amount: </label><input type="text" name="amount" value="">
<input type="submit" name="submit" value="Pay with PayPal">
</form>
Robert's solution is on the right track, however a non-hosted PayPal form will not work without the hidden "business" field (which should have a value of the email address associated with your PayPal account.)
Other fields should be included for thoroughness:
<input type="hidden" name="business" value="myemail#here.com">
<input type="hidden" name="item_name" value="Donation Description">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">

Pre-populate "Send Payment" data on PayPal?

Is there a way to pre-populate the "Send Payment" data on PayPal? I don't wan't a pay now button, I just want to be able to have a button for my own internal use that launches the Paypal website and pre populates the fields to send a payment to somebody. Is that possible?
I've tried using a form that submits the data to paypal, but I have a problem, the AMOUNT field doesn't populate, and I have no idea what I'm doing wrong!
This is what I have so far:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target = "paypal">
<input type="hidden" name="cmd" value="_send-money">
<INPUT TYPE="hidden" name="charset" value="utf-8">
<INPUT TYPE="hidden" NAME="email" VALUE="someone#gmail.com">
<INPUT TYPE="hidden" NAME="currency_code" VALUE="USD">
<input type="hidden" name="amount" value="15.00">
<input type="submit" value="Open Paypal">
</form>
You could try redirecting to the paypal.me/accountname/moneyamount (example: paypal.me/johnsmith/50) to have it bring you to a page that pays the john smith account with a pre-filled amount of $50. This functionality is set up by default.
https://www.paypal-community.com/t5/Products-and-Services/Can-the-PayPal-me-URL-be-modified-to-pre-fill-the-quot-Note-quot/td-p/1509015

Paypal Buy Now button transaction response issue

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.

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.

Trying to setup Paypal registration form, need some help!

I'm trying to setup a registration form for some workshops that last a week. Basically, they can sign up for the workshops individually or the whole week. Depending on what they select, the price will change. I get how to send this information to paypal, however I also want to submit information to my own DB. How would I submit to paypal and file the info into my DB at the same time?
I also want to have a variable that is returned that verifies they have paid so I can mark it in my DB.
Would I just have another page that would put all this info into the DB (once submitted) then also put the info into hidden form fields and then automatically submit to paypal?
Thanks in advance! :)
"When payment is successful your user is returned to your self which is when you can record the payment in the db."
That's exactly what you shouldn't be doing.
Depending on a buyer to return to your website in order to update an order status is the worst thing you can do.
PayPal IPN was designed with especially this use case in mind.
Simply add in
This will ensure PayPal will POST to you whenever the payment has completed. Even if your buyer has already closed his/her browser.
You can use the 'custom' fields to link an IPN POST to a transaction made on your site. For example:
will ensure you get an IPN POST with $_POST['custom'] of '1122334455'. From there, it's simply a matter of making a db call to update the order status to 'paid', or whatever you use to mark it as payment received.
Oh, and don't forget to post the data back to https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate to validate the IPN POST. More info is available at https://www.paypal.com/ipn/
So I guess you are probably using Website payment standard.
If so the process is like this:.
Users signs up for a particular workshop using your form (select prices, time etc etc)
On submit you process the form (check validation etc)
If you happy with this then you generate a from that is automatically posted to paypal that looks like this:
<body onLoad="document.forms['paypal_auto_form'].submit();">
<p>Please wait</p>
<form method="post" action="https://www.paypal.com/cgi-bin/webscr" name="paypal_auto_form"/>
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="currency_code" value="AUD" />
<input type="hidden" name="quantity" value="1" />
<input type="hidden" name="business" value="PAYPAL#EMAIL.COM" />
<input type="hidden" name="return" value="http://domain.com/paypal/success" />
<input type="hidden" name="cancel_return" value="http://domain.com/paypal/cancel" />
<input type="hidden" name="notify_url" value="http://domain.com/paypal/ipn" />
<input type="hidden" name="custom" value="1234567890" />
<input type="hidden" name="item_name" value="Paypal Test Transaction" />
<input type="hidden" name="item_number" value="6941" />
<input type="hidden" name="amount" value="197" />
<p><input type="submit" name="pp_submit" value="Pay Now!" /></p></form>
</body>
The values you of course customize to what you want. Look at Appendix A of the paypal documentation for the variables. You can also add your own log with cpp_header_image or something like that.
The users is taken to paypal to process payments
When payment is successful your user is returned to your self which is when you can record the payment in the db. You might use some for of key or cookie variable to track the payment they have made.
You probably want to use the IPN to double check that it was successfully paid.
If all this is too hard just use http://wufoo.com/ and add the payment module to the form.