Solved

PayPal Issues

Posted on 2011-09-13
5
308 Views
Last Modified: 2012-05-12
We have been developing our website for months using PayPal in the "sandbox" mode. It worked fine. Today I tried to make it go live, with no success.

I am using PPHttpPost php function. The response in $httpParsedResponseAr["ACK"] is "Failure". I know the credit card being used is good, the expiration date was correct, etc.

It MIGHT be that the parameters being used for UserID, Password & Signature are no longer valid. I realize those are different for live use than sandbox & I changed them accordingly.

Is there some code I can look at to determine the error true cause?

Thanks
function PPHttpPost($methodName_, $nvpStr_) {
	global $environment;
	global $res;
	// Set up your API credentials, PayPal end point, and API version.
	$API_UserName = urlencode($res['username']);
	$API_Password = urlencode($res['password']);
	$API_Signature = urlencode($res['signature']);
	$API_Endpoint = "https://api-3t.paypal.com/nvp";
	if("sandbox" === $environment || "beta-sandbox" === $environment) {
		$API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";
	}
	$version = urlencode('51.0');
	// Set the curl parameters.
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);
	// Turn 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);
	// Set the API operation, version, and API signature in the request.
	$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";
	// Set the request as a POST FIELD for curl.
	curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
	// Get response from the server.
	$httpResponse = curl_exec($ch);
	if(!$httpResponse) {
		exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
	}
	// Extract the response details.
	$httpResponseAr = explode("&", $httpResponse);
	$httpParsedResponseAr = array();
	foreach ($httpResponseAr as $i => $value) {
		$tmpAr = explode("=", $value);
		if(sizeof($tmpAr) > 1) {
			$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
		}
	}
	if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
		exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
	}
	return $httpParsedResponseAr;
}

Open in new window

0
Comment
Question by:Richard Korts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 4

Accepted Solution

by:
h4hardy earned 250 total points
ID: 36535498
for this you have to contact to paypal..sometime paypal also stopped the transaction for that particular account..you can try..

-- check the sandbox api username and password..can it active or not?

-- send the request to paypal with your code

let me know if i would help you.
0
 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 250 total points
ID: 36536341
I think my first approach would be to use var_dump() to see this: $httpResponse.  You will want to use "view source" to check the output.
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 36537270
Another tip about setting up a credit card transactions, many of the providers offer a fake credit card number to try for each of MC and Visa for you to try when you are going live. Maybe you already know this.
0
 
LVL 29

Expert Comment

by:coreybryant
ID: 36539032
Most companies use the same testing numbers, but you should be able to produce results with these Credit Card Testing Numbers.

Visa: 4111111111111111 or 4012888888881881
MasterCard: 5105105105105100 or 5555555555554444
Discover: 6011000990139424 or 6011111111111117
American Express: 371449635398431 or 378282246310005

The expiration date should not matter (provided it is not before August 2011).  Plus before submitted to Paypal (or any electronic payment gateway), you should check to see if it validates (How Credit Card Numbers Are Determined).  This will save you a transaction fee.
0
 

Author Closing Comment

by:Richard Korts
ID: 36544878
Be on the lookout for my next question.

PayPal is a nightmare.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Original post  on Monitis Blog. Web performance monitoring is broken into two camps: passive and active. Passive monitoring is defined as looking at real-world historical performance by monitoring actual log-ins, site hits, clicks, requests for …
The viewer will learn how to dynamically set the form action using jQuery.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question