Post by zeeb100 » Tue Oct 13, 2009 6:01 pm

aatelfer
you could post the solution clearly step by step you would be my savior O0

New member

Posts

Joined
Tue Sep 15, 2009 11:18 pm

Post by aatelfer » Tue Oct 13, 2009 6:13 pm

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);
}

Newbie

Posts

Joined
Tue Oct 13, 2009 9:09 am

Post by zeeb100 » Wed Oct 14, 2009 6:18 pm

Apologize for the delay answer now I'm testing ...

New member

Posts

Joined
Tue Sep 15, 2009 11:18 pm

Post by zeeb100 » Wed Oct 14, 2009 7:10 pm

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?

New member

Posts

Joined
Tue Sep 15, 2009 11:18 pm

Post by Qphoria » Thu Oct 15, 2009 12:14 am


Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Daniel » Thu Oct 15, 2009 6:07 am

could it be that some of you are using SMTP when you don;t need to and errors are stoping the order being confirmed?

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by zeeb100 » Thu Oct 15, 2009 4:55 pm

I'm not using SMTP
Immagine 2.png

Immagine 2.png (28.76 KiB) Viewed 5346 times


New member

Posts

Joined
Tue Sep 15, 2009 11:18 pm

Post by aatelfer » Fri Oct 16, 2009 4:08 pm

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.

Newbie

Posts

Joined
Tue Oct 13, 2009 9:09 am

Post by zeeb100 » Tue Oct 27, 2009 11:06 pm

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
:'(

New member

Posts

Joined
Tue Sep 15, 2009 11:18 pm

Post by Daniel » Tue Oct 27, 2009 11:31 pm

What ever that code is above is not going to fix your problem.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by zeeb100 » Wed Oct 28, 2009 1:31 am

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??

New member

Posts

Joined
Tue Sep 15, 2009 11:18 pm
Who is online

Users browsing this forum: No registered users and 13 guests