2 Replies - 979 Views - Last Post: 02 August 2011 - 02:37 PM Rate Topic: -----

#1 rhboarder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 05-December 09

PayPal NVP test failing with GetExpressCheckout

Posted 02 August 2011 - 09:35 AM

Currently $res(returned by hash_call) ack = Failure and I get the error 81002 'Specified method is not supported'(GetExpressCheckout). Ive viewed the request string before sending it and it was good, I've also searched on google and found nothing helpful..
public function getExpressCheckout()
{
  $nvp = 'TOKEN=' . $this->token;
  $res = $this->hash_call('GetExpressCheckout', $nvp);
  ...
}

private function hash_call($methodName, $nvpStr)
{
  //setting the curl parameters.
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, API_ENDPOINT);
  curl_setopt($ch, CURLOPT_VERBOSE, 1);
  //turning off the server and peer verification(TrustManager Concept).
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_POST, 1);

  //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
  //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php
  if(USE_PROXY)
    curl_setopt ($ch, CURLOPT_PROXY, PROXY_HOST. ":" . PROXY_PORT);

  //NVPRequest for submitting to server
  $nvpreq="METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode(NVP_VERSION) . "&PWD=" . urlencode(API_PASSWORD)     . "&USER=" . urlencode(API_USERNAME) . "&SIGNATURE=" . urlencode(API_SIGNATURE) . '&' . $nvpStr;

  //setting the nvpreq as POST FIELD to curl
  curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

  //getting response from server
  $response = curl_exec($ch);

  //convrting NVPResponse to an Associative Array
  $nvpResArray = $this->deformatNVP($response);

  if (curl_errno($ch))
  {
    //put curl_errno($ch) and curl_error($ch) into str and add to errors array
    curl_close($ch);
    return false;
  }
  //closing the curl
  curl_close($ch);

  return $nvpResArray;
}




Is This A Good Question/Topic? 0
  • +

Replies To: PayPal NVP test failing with GetExpressCheckout

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6091
  • View blog
  • Posts: 23,605
  • Joined: 23-August 08

Re: PayPal NVP test failing with GetExpressCheckout

Posted 02 August 2011 - 01:17 PM

Well, the error certainly suggests that the method you're trying to call, GetExpressCheckout, isn't a valid call. Have you checked with PayPal about that? I've never used the PayPal API, but some of the Googling I did to see what I could fund suggests perhaps the method name might be GetExpressCheckoutDetails. Like this page.
Was This Post Helpful? 0
  • +
  • -

#3 rhboarder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 05-December 09

Re: PayPal NVP test failing with GetExpressCheckout

Posted 02 August 2011 - 02:37 PM

Wow it's silly how stupid our(programmers in general) mistakes can be lol, you were right JackOfAllTrades i had the name wrong, I was using GetExpressCheckout (which is the name of the specific api) whereas the methodName was GetExpressCheckoutDetails!

One other issue I'm having with this PayPal stuff is that when I log in to my sandbox test site(to pay for item on my website) it doesn't show order information like the cost/other item info, etc. There's just the confirm button which when pressed redirects back to my site which is basically the end of the transaction. Any ideas as to why I don't see any info on the paypal page?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1