The IPN Response is always 'INVALID'

dovberman
Contributor
Contributor

I have a PaymentReceipt.aspx page that is the IPN Listener. The page_open code is a copy of the PayPal recommended code. "INVALID" is always returned. There are no reported errors. The listener page opens as expected.  However the test site account history log show that all the test transactions were completed succesfully.

 

 

I have been troubleshooting this for 3 days.

 

Here is the Page_Load code in the listener:

 

 //Post back to either sandbox or live
 
        string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr";
         
        //string strLive = "https://www.paypal.com/cgi-bin/webscr";
         
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox);

 

       //Set values for the request back
         
        req.Method = "POST";
         
        req.ContentType = "application/x-www-form-urlencoded";
         
        byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
         
        string strRequest = Encoding.ASCII.GetString(param);
         
        strRequest += "&cmd=_notify-validate";
         
        req.ContentLength = strRequest.Length;
         
        //for proxy
         
        //WebProxy proxy = new WebProxy(new Uri("http://urlort#");
         
        //req.Proxy = proxy;
         
        //Send the request to PayPal and get the response
         
        StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
         
        streamOut.Write(strRequest);
         
        streamOut.Close();
         
        StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
         
        string strResponse = streamIn.ReadToEnd();
         
        streamIn.Close();

        lblStatus.Text = strResponse;  // Always INVALID

 

 -----

Test account log:

 

Recurring Payments details

Profile information Profile ID I-2H164SPH6JJN Product/service StockPickerMax Subscription Start date Dec 26, 2009 End date Feb 26, 2010 Profile Status Active
|
Merchant information Merchant name David Martin's Test Store Customer service URL Billing terms Next payment date Jan 26, 2010Payment activity Payment type Initial Payment Amount due $0.00 USD Amount received $0.00 USD Payment type Trial Period

 

 Calling page form:

 

form name="PrePage" runat =server action="https://www.sandbox.paypal.com/cgi-bin/webscr" method

="post"

input type="hidden" name="cmd" value

="_s-xclick"

input type="hidden" name="hosted_button_id" value

="1089338"


input type="hidden" name="on0" value="One month non recurring"

One month non recurring

input type="hidden" name="on1" value="Credit Card info not stored"Credit Card info not storedinput type="text" name="os1" maxlength="60"


input type="image" src="https://www.sandbox.paypal.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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height

="1"

br


asp:TextBox ID="txtIPNReturn" Text = "abc" runat="server" Width="100px" asp:TextBox

form

 

 

 

 

 

 

 

 

 

 

 

 

form name="PrePage" runat =server action="https://www.sandbox.paypal.com/cgi-bin/webscr" method

="post"

 

input type="hidden" name="cmd" value

="_s-xclick">

 

input type="hidden" name="hosted_button_id" value

="1089338"

 

 

table

 

input type="hidden" name="on0" value="One month non recurring"

One month non recurring>

 

input type="hidden" name="on1" value="Credit Card info not stored"Credit Card info not storedinput type="text" name="os1" maxlength="60"

 

 

input type="image" src="https://www.sandbox.paypal.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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height

="1"

 

br

 

asp:TextBox ID="txtIPNReturn" Text = "abc" runat="server" Width="100px" asp:TextBox

 

form

 

 

 

 

 

 

 

Login to Me Too
1 REPLY 1

dovberman
Contributor
Contributor

Here is some additional information:

 

The URL returned to the listerner is

 

 //www.stockpickermax.com/paymentReceipt.aspx?

 

merchantRet.x=Return+To+Merchant

 

&auth=_v-gTusGRYugOh938zDJ-RiMYoXY0CNUWmNP5ZJDg-uX9tKzx0IiZKcLuFIcjdWHAUmM2ACapyyeif1j

 

&form_charset=UTF-8

What is this ?

Other research indicates:

For PayPal to return VERIFIED, your IPN script needs to post back
ALL the variables that were posted to it in the first place.
In other words, if your script only needs to manipulate 1 or 2 variables,
it is not enough to post back to PayPal
only the variables/values your script is concerned with.
Your script should post back EVERYTHING
that was initially posted to it from PayPal.
This is the only way PayPal will return VERIFIED

What does this mean?

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.