special return info for paypal payments

08.01.2021 12:16
#1
kreutzjj
Joomshopping forum user no avatar
Name: kreutz
08.01.2021
Posts: 13
Quote
special return info for paypal payments

Hello,

The shop and paypal ordering works fine.
But when i return from the paypal page i get to the same page (checkout/finish.php) as if i would have payed with another payment method.

That is a big problem.
Paypal says in its terms of usage that i must give special return information.
Something like "the payment was successful" and so on...

I dont want to change the finish.php Template cause otherwise other payment methods would get the same return...
So is there a variable on that I can relay on?

something like:

if($payment=="paypal") and ($status=="success"){
echo "terms of ... for Paypal."}
else {
echo "Thanks for the ordering..."
}

thanks and greetings from germany


Website Url: stonesunlimited.de
 
09.01.2021 11:30
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25934
Quote
Aw: special return info for paypal payments

controller/checkout.php

function finish(){

use $order_id for get payment information

 
09.01.2021 13:22
#3
kreutzjj
Joomshopping forum user no avatar
Name: kreutz
08.01.2021
Posts: 13
Quote
Aw: special return info for paypal payments

"controller/checkout.php"

function finish(){

use $order_id for get payment information
---

I found the file and function, but have no idea how i should use it.
After finishing the payment with paypal i get redirected to finish.php and there i don#t have access to the $order_id.
I tried dumping all get or post parameters and did not get a single variable.
So how should i use it?

 
09.01.2021 14:15
#4
kreutzjj
Joomshopping forum user no avatar
Name: kreutz
08.01.2021
Posts: 13
Quote
Aw: special return info for paypal payments

i changed the checkout php and added the line
$view->assign('order_id', $order_id);

i changed the template finish.php and tried to echo $this->order_id

it worked sometimes.
in google chrome the vars $this->order_id and $this->text are empty
in firefox they are filled with parameters...

Do you have any code that is not working with chrome? I have no idea what todo.. php should make no difference so how do you receive the id? Javascript? how to fix this?


Last change: 09.01.2021 16:01
 
09.01.2021 17:22
#5
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25934
Quote
Aw: special return info for paypal payments

$order = JSFactory::getTable('order', 'jshop');
$order->load($order_id);

$order->payment_method_id - (default 3 - paypal)


#####
- Do you have any code that is not working with chrome?

End row
$checkout->clearAllDataCheckout(); - delete order data from session

1 time [goto finish page] $order_id = xxx;
2 time [goto finish page] $order_id = EMPTY

Problem in redirect in chrom or ...(should work in both browsers)

 
10.01.2021 11:53
#6
kreutzjj
Joomshopping forum user no avatar
Name: kreutz
08.01.2021
Posts: 13
Quote
Aw: special return info for paypal payments

Hi,

i added your code and passed everything to the finish.php

for testing i echo

echo "<p>1. ".$this->order_id; // $checkout->getEndOrderID()
echo "<p>2. ".$this->text; // $checkout->getFinishStaticText()
echo "<p>3. ".$this->t_order_id; // $order->load($order_id)
echo "<p>4. ".$this->t_pm_method; // $order->payment_method_id

in Firefox i get this return
1. 58
2. Vielen Dank...
3. 1
4. 3

So everything worked

in Chrome i get this return
1.
2. Vielen Dank...
3. 1
4.

So still 2 of 4 parameters are empty and am not sure how i could solve the problem..
it is definetly not the redirektion, cause some parameters where passed...

 
10.01.2021 11:55
#7
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25934
Quote
Aw: special return info for paypal payments

url?
test login?

 
10.01.2021 13:22
#8
kreutzjj
Joomshopping forum user no avatar
Name: kreutz
08.01.2021
Posts: 13
Quote
Aw: special return info for paypal payments

ah i finally understand what you tried to tell me.
the JSFactory::getTable should have given me the orders table..
but since $order_id is empty (in Chrome) $order->load($order_id); doesnt work.
So i get an object with NULL data.
Is there another way to receive the $order_id cause $checkout->getEndOrderId(); doesnt seem to work (in Chrome)

the website is:

https://www.stonesunlimited.de

no login for buying needed or do you mean one for joomla or ftp?
i still have paypal sandbox active.
so you can try. i guess you have a sandbox account. ;)

I added a screenshot of the last Chrome website after a successfull paypal payment.
as you can see i simply made a dump of the class to see if anything was passed... and everything was NULL. *sigh*
Aw: special return info for paypal payments

EDIT: (SOLVED)
The problem is that the redirect has status 303 but should have 307.
Firefox ignores the variable passing rules and so it works.
chrome... deletes all post data (303 only sents get data) so all data is lost.

I changed your checkout.php
added protected variable $redirectStatus;
and added an overrite the the redirect function:

public function redirect() {
if ($this->redirect) {
$app = \JFactory::getApplication();

// Enqueue the redirect message
$app->enqueueMessage($this->message, $this->messageType);

// Execute the redirect
if (!empty($this->redirectStatus)) {
$status = $this->redirectStatus;
$this->redirectStatus = null;
$app->redirect($this->redirect, $status);
} else {
$app->redirect($this->redirect);
}
}

return false;
}

for checking of paypalpayment i simply can check now against $_POST["paiment_status"] == "Completed" and it works now.
...
in both browsers.

The solution might be interesting for you cause with paypal agb the shop must return another information... maybe a featrue for your next update.


Last change: 10.01.2021 17:41
 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.