Click here to Skip to main content
13,189,884 members (61,676 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi,
When I send a request to the paypal using following code lines for authentication,
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 1-May-11 19:08pm
Updated 1-May-11 21:00pm
v5
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

In your error response you see the following text:

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

and in your code you have:

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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Try this and provide information that are required, replace it with your details

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
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web03 | 2.8.171016.2 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100