Page 3 of 3

Re: version 1.3.2 but paypal still don't work

Posted: Tue Oct 13, 2009 6:01 pm
by zeeb100
aatelfer
you could post the solution clearly step by step you would be my savior O0

Re: version 1.3.2 but paypal still don't work

Posted: Tue Oct 13, 2009 6:13 pm
by aatelfer
aatelfer wrote:Hey you guys, I did some tests and realized that something is happening inside "http://servername.com/shop/payment/pp_standard/callback" that is causing a problem.

I created a paypal.php file in the shop root and changed the callback to that url. It seems to be working well.

Something is happening before the callback is called.
Take a look at what I did to sort out this problem:

*** File: http://servername.com/store/paypal.php ***

// Load the paypal wrapper...found at phpclasses.org
require_once('system/library/paypal.php');

// Test server
$p = new Paypal('https://www.sandbox.paypal.com/cgi-bin/webscr');
//$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';

if ($p->validate_ipn()) {
$request = 'response=' . 'VERIFIED';

foreach ($p->ipn_data as $key => $value) {
$request .= '&' . $key . '=' . urlencode(stripslashes($value));
}

$ch = curl_init('http://'.$_SERVER['SERVER_NAME'].'/shop/index.php?route=payment/pp_standard/callback');

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$response = curl_exec($ch);
}else{
$subject = 'Instant Payment Notification - Reception failed';
$to = 'YOUR EMAIL ADDRESS'; // your email
$body = "An instant payment was unsuccessful.\n";
$body .= "from ".$p->ipn_data['payer_email']." on ".date('m/d/Y');
$body .= " at ".date('g:i A')."\n\nDetails:\n";

foreach ($p->ipn_data as $key => $value) { $body .= "\n$key: $value"; }
mail($to, $subject, $body);
}

Re: version 1.3.2 but paypal still don't work

Posted: Wed Oct 14, 2009 6:18 pm
by zeeb100
Apologize for the delay answer now I'm testing ...

Re: version 1.3.2 but paypal still don't work

Posted: Wed Oct 14, 2009 7:10 pm
by zeeb100
aatelfer
These were my operaizone

download the file from the following link paypal.class.php

Code: Select all

http://phpsoft.mirrors.phpclasses.org/browse/file/9167.html

I create the file in http://www.mystore / store / paypal.php

Code: Select all

<?php
// Load the paypal wrapper...found at phpclasses.org
require_once('system/library/paypal.class.php');

// Test server
$p = new Paypal('https://www.sandbox.paypal.com/cgi-bin/webscr');
//$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';

if ($p->validate_ipn()) {
	$request = 'response=' . 'VERIFIED';

	foreach ($p->ipn_data as $key => $value) {
		$request .= '&' . $key . '=' . urlencode(stripslashes($value));
	}

	$ch = curl_init('http://'.$_SERVER['SERVER_NAME'].'/store/index.php?route=payment/pp_standard/callback');

	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_HEADER, false);
	curl_setopt($ch, CURLOPT_TIMEOUT, 30);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

	$response = curl_exec($ch);
	}
else{
	$subject = 'Instant Payment Notification - Reception failed';
	$to = 'xxxxx@xxx.com'; // your email
	$body = "An instant payment was unsuccessful.\n";
	$body .= "from ".$p->ipn_data['payer_email']." on ".date('m/d/Y');
	$body .= " at ".date('g:i A')."\n\nDetails:\n";

	foreach ($p->ipn_data as $key => $value) { $body .= "\n$key: $value"; }
	mail($to, $subject, $body);
	}
?>

copied the files paypal.class.php in the folder " system/library/ "

I log into my account paypal and change the address in IPN

Code: Select all

http://www.mystore.com/store/paypal.php

make on a transaction test and the result is the same in the database status_order is set to "0"


have done something wrong?

Re: version 1.3.2 but paypal still don't work

Posted: Thu Oct 15, 2009 12:14 am
by Qphoria

Re: version 1.3.2 but paypal still don't work

Posted: Thu Oct 15, 2009 6:07 am
by Daniel
could it be that some of you are using SMTP when you don;t need to and errors are stoping the order being confirmed?

Re: version 1.3.2 but paypal still don't work

Posted: Thu Oct 15, 2009 4:55 pm
by zeeb100
I'm not using SMTP
Immagine 2.png

Immagine 2.png (28.76 KiB) Viewed 5356 times


Re: version 1.3.2 but paypal still don't work

Posted: Fri Oct 16, 2009 4:08 pm
by aatelfer
zeeb100 wrote:aatelfer
These were my operaizone

download the file from the following link paypal.class.php

Code: Select all

http://phpsoft.mirrors.phpclasses.org/browse/file/9167.html

I create the file in http://www.mystore / store / paypal.php

Code: Select all

<?php
// Load the paypal wrapper...found at phpclasses.org
require_once('system/library/paypal.class.php');

// Test server
$p = new Paypal('https://www.sandbox.paypal.com/cgi-bin/webscr');
//$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';

if ($p->validate_ipn()) {
	$request = 'response=' . 'VERIFIED';

	foreach ($p->ipn_data as $key => $value) {
		$request .= '&' . $key . '=' . urlencode(stripslashes($value));
	}

	$ch = curl_init('http://'.$_SERVER['SERVER_NAME'].'/store/index.php?route=payment/pp_standard/callback');

	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_HEADER, false);
	curl_setopt($ch, CURLOPT_TIMEOUT, 30);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

	$response = curl_exec($ch);
	}
else{
	$subject = 'Instant Payment Notification - Reception failed';
	$to = 'xxxxx@xxx.com'; // your email
	$body = "An instant payment was unsuccessful.\n";
	$body .= "from ".$p->ipn_data['payer_email']." on ".date('m/d/Y');
	$body .= " at ".date('g:i A')."\n\nDetails:\n";

	foreach ($p->ipn_data as $key => $value) { $body .= "\n$key: $value"; }
	mail($to, $subject, $body);
	}
?>

copied the files paypal.class.php in the folder " system/library/ "

I log into my account paypal and change the address in IPN

Code: Select all

http://www.mystore.com/store/paypal.php

make on a transaction test and the result is the same in the database status_order is set to "0"


have done something wrong?

What I had realized is that something is happening when "http://www.mystore.com/store/index.php? ... d/callback" is called. It messes something up when the post data is posted back to paypal.

All I did was change the callback url in pp_standard.php to "http://www.mystore.com/store/paypal.php". By doing this you can bypass the opencart framework.
Once you have VERIFIED the data with paypal you send that data to "http://www.mystore.com/store/index.php? ... d/callback" so it logs the order.

Here are the steps:

1 - Change callback url in pp_standard.php (Line 32... I think)

2 - setup your paypal.php file in the shop root (I modified the constructor in paypal.class.php)

3 - Comment out the paypal verification code in pp_standard.php (because its being done in paypal.php in the
shop root) and only use the code that checks to see if the order exists and if it is verified.
This is what I have in the callback method after the order is retrieved:

Code: Select all

	
	     if ($order_info) {
			if (strcmp($this->request->post['response'], 'VERIFIED') == 0) {
				$this->model_checkout_order->confirm($order_id, 
                                                                              $this->config->get('pp_standard_order_status_id'));
				return true;
			}else{
			}
		}
       
Hope this helps. Later.

Re: version 1.3.2 but paypal still don't work

Posted: Tue Oct 27, 2009 11:06 pm
by zeeb100
sorry for the late reply .. but the instructions I was misled a bit .. I know I am a little unable .. if you could describe step up par ... please .. apologize for the inconvenience
:'(

Re: version 1.3.2 but paypal still don't work

Posted: Tue Oct 27, 2009 11:31 pm
by Daniel
What ever that code is above is not going to fix your problem.

Re: version 1.3.2 but paypal still don't work

Posted: Wed Oct 28, 2009 1:31 am
by zeeb100
I noticed the same problem he's not Zen cart is that PayPal has changed something in bees and developers e-commerce open suorce did not update their code??