PayPal IPN Sandbox response always INVALID - asp.net

I'm trying to implement PayPals IPN on my website in asp.net using C#. I am using the sample code given by PayPal found here: https://cms.paypal.com/cms_content/GB/en_GB/files/developer/IPN_ASP_NET_C.txt
I have enabled IPN on my account with the URL of the ipn on my site.
The URL used in the code as you can see in the link above is the sandox url for paypal testing.
I am using the IPN Simulator and It's giving me "IPN sent successfully response" but on my website it displays invalid every time.
I have also tried displaying the strRequest string in a Label and all it shows me is "&cmd=_notify-validate" without quotes. I thought it was meant to add that part on to the rest of the returned data from PayPal.
Here is my button:
This is the button I'm using
<script src="paypal-button.min.js?merchant=myemail"
data-button="buynow"
data-name="name"
data-quantity="1"
data-amount="00.50"
data-currency="GBP"
data-shipping="0"
data-tax="0"
data-env="sandbox"
data-return="http://site.net/thankyou.aspx"
></script>
What is going wrong?
UPDATE:
So.. to recap.
I have 2 sandbox accounts. One business and the other personal. I enabled ipn on the business account. On my website I have the button shown above. The ipn page has the exact same code as the sample code given for the IPN in asp.net from paypal. I got the to website, click the buy now button and make the purchase using the personal account to the sandbox business account. The payment shows as complete and shows as sent with code 200 in the ipn history for the business account but when i check the label i entered on the ipn page it shows the word invalid.
Thanks!

Related

Testing PayPal Donations with a Sandbox Account

I have a WordPress form that processes data and redirects to this url to complete the PayPal donation
https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=sb-5mepe4127835%40business.example.com&currency_code=USD&amount= <amount>&return=http://example.local/about
However, when I submit the form I receive this error from PayPal
We can't complete your donation. This organization's account is inactive.
What am I missing? The reason I have it setup this way is because I want WordPress to save the form data and send a thank you/confirmation email after the payment is complete.
https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=sb-5mepe4127835%40business.example.com&currency_code=USD&amount=&return=http://example.local/about
When testing with any sandbox account, change the domain to point to the www.sandbox.paypal.com sandbox environment , i.e.
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_donations&business=sb-5mepe4127835%40business.example.com&currency_code=USD&amount=&return=http://example.local/about

paypal IPN notifyURL calls wrong url

I am using paypal standard payment done by HTML variables. I have set up IPN url and turned it ON in my profile.
url in profile : http://example.com/IPNHandler.aspx
But I got one more payment page where I need to create different IPN handler and called this URL in "notify_URL" from code.
redirecturl += "&notify_url = http://example.com/IPNHandler2.aspx"
As per the paypal documentation default url in profile gets overridden if we send the notify_url to the paypal. It was working fine till last month, but last month when I tried the second payment its IPN messages sent to first URL in the profile which is "http://example.com/IPNHandler.aspx". Seems "notify_URL" is not working anymore.
Can anyone help me please.

Sending mail in Paypal IPN listener page does not work

I'm working on windows Azure ASP.NET integrating Paypal in it.
I succeeded creating the listener page in my website. After "VERIFIED" was received the page updates the database as I requested, but I cant send a mail - I don't get an error message, but the mail isn't in the inbox (I'm using sendGrid).
I can send a mail in other pages of my website.
What is the best way to send a mail from the listener page in asp.net?
Thanks
If the script is running but your email isn't getting sent then there must be some sort of an error happening, or may be a simple logic flaw in your code.
I wrote this article a while back on how to test PayPal IPN. I'd recommend taking a look at it and following the steps. It will help you track down the problem and get it resolved.

using PayPal IPN with WhooCommerce

I have a web store which for it I defined an IPN in paypal.
lets say the address is: www.x.x .
This is working great.
Recently I lunched another website with woocommerce web shop.
The IPN that should be running hasn't changed.
However for some reason, it doesn't work from the new site.
When I see the history of transcations in paypal...
I see that the Notification URL is diffrent that what is defined in Paypal.
Now it goes to:
https://My_Site/wc-api/WC_Gateway_Papal/
Why it doesn't go to www.x.x as it should? and how do I fix it?
Why does URL defined in Paypal are overwritten?!
Basically there are two ways of defining the IPN URL : one set in PayPal , second website will send it to PayPal via the code as a variable . If the IPN URL is sent via variable then it will override the URL mentioned in account .
So in your case the URL is being sent from WC to PayPal and hence over writing it .
What you will look for is a variable "notify_url" (or NOTIFYURL if using our APIs) and the value of that variable will be the URL Paypal will use for IPN on the specific website.
As Eshan says, if the variable is present, it will override your Paypal account settings so you can remove that line with the variable and in that case, Paypal will then use the IPN URL defined in your Paypal account.
Hope that helps.
Regards,
Florian

notify_url not working in new paypal

I have registered to paypal on live on https://www.paypal.com. Not verified for live.
I can login to https://developer.paypal.com with above login detail.
Here I go for sandbox accounts, I have created two account, one business and one personal.
(Sandbox account are verified)
I am trying for payment integration with Paypal with html form.
I have specified the notify_url, payment goes all right but no notification in notify_url.
I have double checked the notify_url, its working fine.
Anybody there, what seems to be wrong here?
Are you using buttons created and saved to a PayPal account? You may not be able to define a notify_url value through a hosted button. IPN may also be disabled in the account.
Log into the seller account receiving the payment, enable IPN, and set a URL for the post to be sent to. From the "Instant Payment Notification Preferences" section (where you enable IPN) you can view the IPN History which shows you the last 28 days of IPN posts sent for that account.
I've run into the same problem. A buy now hosted button was saved without errors, but a notify_url was not notified by paypal.
There is a work around, you can specify a notify_url in your profile globally.
paypal docs
For future reference: I just had the same problem. This caused it in my case:
I have been testing on the development server. This server was not accessible for IPs outside of our company (for security purposes). So the IPN-call from paypal never came trough to the IPN-script on the development server.
Took me one day to figure that out...
If you already done the test of the IPN via the simulator https://developer.paypal.com/developer/ipnSimulator/ and checked if it's OK?
Have you checked you set the "pixel" in your HTML form? If it's missing, the notify_url won't work. This solution worked for me.
For Sandbox, use : <img alt="" src="https://www.sandbox.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1">

Resources