Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
When I send a request to the paypal using following code lines for authentication,
C#
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create("https://api-3t.sandbox.paypal.com/nvp");
StringBuilder URLQueryString = new StringBuilder();
URLQueryString.Append("USER=bilal._1303994161_biz_api1.muskysoftware.com&");
URLQueryString.Append("PWD=somepassword&");
URLQueryString.Append("SIGNATURE=A3s7K7bICpflbySN2Fd3AlzTTbF1AZLBiCeUdtRindoV3BOytl-BKSsv&");
URLQueryString.Append("SUBJECT=Hello this a test&");
URLQueryString.Append("VERSION=56.0");
objRequest.Method = "POST";
objRequest.ContentLength = URLQueryString.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";

I get the following response:

ACK=Failure&L_ERRORCODE0=81002&L_SHORTMESSAGE0=Unspecified%20Method&L_LONGMESSAGE0=Method<br />
%20Specified%20is%20not%20Supported&L_SEVERITYCODE0=Error<br />


Why is it failing? Please help.

Thank you.
Posted
Updated 1-May-11 21:00pm
v5

In your error response you see the following text:

Method%20Specified%20is%20not%20Supported

and in your code you have:

C#
objRequest.Method = "POST";


Try changing that line to:

objRequest.Method = "GET";


You're adding querystring variables to the URL, they're generally if not always associated with Http GET.
 
Share this answer
 
Try this and provide information that are required, replace it with your details

C#
public string GetSubmitUrl()
{
      StringBuilder url = new StringBuilder();
      url.Append( this.PayPalBaseUrl + "cmd=_xclick&business="+
            HttpUtility.UrlEncode( AccountEmail ) );
      if( BuyerEmail != null && BuyerEmail != "" )
            url.AppendFormat( "&email={0}", HttpUtility.UrlEncode( BuyerEmail ) );
      if (Amount != 0.00M)
            url.AppendFormat("&amount={0:f2}", Amount);
      if( LogoUrl != null && LogoUrl != "" )
            url.AppendFormat( "&image_url={0}", HttpUtility.UrlEncode( LogoUrl ) );
      if( ItemName != null && ItemName != "" )
            url.AppendFormat( "&item_name={0}", HttpUtility.UrlEncode( ItemName ) );
      if( InvoiceNo  != null && InvoiceNo != "" )
            url.AppendFormat( "&invoice={0}", HttpUtility.UrlEncode( InvoiceNo ) );
      if( SuccessUrl != null && SuccessUrl != "" )
            url.AppendFormat( "&return={0}", HttpUtility.UrlEncode( SuccessUrl ) );
      if( CancelUrl != null && CancelUrl != "" )
            url.AppendFormat( "&cancel_return={0}", HttpUtility.UrlEncode( CancelUrl ) );
      return url.ToString();
}



Hope it helps
 
Share this answer
 
Hi,

The error is caused by:

URLQueryString.Append("VERSION=56.0");

You are not supplying a recent valid version--try something over 62 or ask PayPal for a correct version.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900